An array formula in Google Sheets is a single formula that can process multiple values at once, returning either a single result or a whole range of results. To use one, you type a formula like =ARRAYFORMULA(A2:A10*B2:B10) in a cell, which multiplies each corresponding pair in two columns and spills the results down automatically. You can also use the newer =MAP(), =BYROW(), or =BYCOL() functions for similar tasks, but ARRAYFORMULA() remains the most direct way to force array behavior in Google Sheets.
What Is an Array Formula in Google Sheets?
An array is a group of values arranged in rows and columns, like a range (e.g., A1:C10). A regular formula like =A1*B1 works on one pair of cells. An array formula, however, can work on an entire range at once. For example, =ARRAYFORMULA(A1:A5*B1:B5) multiplies A1 by B1, A2 by B2, and so on, returning five results in a column. Without ARRAYFORMULA(), Google Sheets would only calculate the first value (A1*B1) and ignore the rest.
Array formulas are useful when you want to avoid dragging a formula down hundreds of rows or when you need to perform calculations that involve multiple ranges at once, such as summing products across columns. They also help keep your spreadsheet cleaner because you only need one formula instead of many.
How Does ARRAYFORMULA Work?
The ARRAYFORMULA() function tells Google Sheets to treat the formula inside it as an array calculation. When you use it, the formula can return multiple values that automatically fill adjacent cells. For instance, if you put =ARRAYFORMULA(A2:A10+B2:B10) in cell C2, it will show the sum of A2+B2 in C2, A3+B3 in C3, and so on down to C10. The results “spill” into the cells below.
You can also use array formulas with functions that normally return a single value, like SUM(), to create a conditional sum. For example, =SUM(ARRAYFORMULA((A2:A10>5)*B2:B10)) sums all values in B2:B10 where the corresponding A cell is greater than 5. The multiplication acts as a boolean filter (TRUE becomes 1, FALSE becomes 0).
In Google Sheets, you don’t always need to type ARRAYFORMULA() manually. If you enter a formula that naturally returns multiple values (like =A2:A10*B2:B10) and press Ctrl+Shift+Enter (Windows) or Cmd+Shift+Enter (Mac), Google Sheets will automatically wrap it in ARRAYFORMULA(). On the web, you can also use the “Array formula” checkbox under the formula bar.
When Should You Use an Array Formula?
Use an array formula when you need to:
- Perform the same calculation on a whole column or row without copying the formula down.
- Combine ranges of different sizes, like when you want to compare two lists.
- Use functions like
SUMIF()orCOUNTIF()with multiple conditions that require array processing. - Create dynamic ranges that automatically expand when new data is added (e.g., using
FILTER()insideARRAYFORMULA()). - Return multiple values from a single formula, such as extracting unique items with
UNIQUE().
However, array formulas can be slower on very large datasets because they calculate many cells at once. If your spreadsheet has thousands of rows, consider using QUERY() or FILTER() directly, as they are optimized for such tasks.
Common Array Formula Examples
Here are three practical examples you can copy into your own sheet. Assume you have data in columns A and B, starting at row 2.
Example 1: Multiply two columns
In cell C2, enter:=ARRAYFORMULA(A2:A10*B2:B10)
This will fill C2:C10 with the product of each row.
Example 2: Sum all values in B where A is greater than 10
In any empty cell, enter:=SUM(ARRAYFORMULA((A2:A10>10)*B2:B10))
If A2:A10 contains 12, 5, 15, and B2:B10 contains 100, 200, 300, the result is 100*1 + 200*0 + 300*1 = 400.
Example 3: Concatenate first and last names with a space
If A2:A10 has first names and B2:B10 has last names, enter in C2:=ARRAYFORMULA(A2:A10 & " " & B2:B10)
This will produce full names like “John Smith”.
Common Problems and How to Fix Them
Many users run into issues with array formulas. Here are the most frequent ones:
- #N/A error: This often happens when the ranges have different sizes. For example,
=ARRAYFORMULA(A2:A10*B2:B5)will fail because the ranges don’t match. Make sure both ranges have the same number of rows (or columns). - #VALUE! error: This occurs when a function inside the array formula doesn’t accept arrays. For instance,
SUM()works, butVLOOKUP()does not directly. You may need to useARRAYFORMULA()withIF()to handle lookups. - Spill range is blocked: If you have something in the cell where the array result would appear, you’ll see a #REF! error. Clear the obstructing cells or move the formula.
- Array formula is too large: If your formula references entire columns (e.g., A:A), it may try to process 1,000,000 rows and slow down. Use a specific range like A2:A1000 instead.
Array Formulas vs. Regular Formulas and QUERY
Regular formulas are simpler and easier to debug, but they require manual dragging. Array formulas are powerful but can be harder to read. QUERY() is another option; it uses a SQL-like language and can aggregate, filter, and sort data in one go. For example, =QUERY(A2:B10, "select A, sum(B) group by A") does the same thing as a complex array formula but is often faster and more readable.
However, QUERY() has a learning curve and doesn’t handle certain operations (like element-wise multiplication) as easily. Array formulas are better for arithmetic on ranges, while QUERY() shines for data aggregation and manipulation. In Excel, the equivalent is dynamic arrays (e.g., =A2:A10*B2:B10 without needing ARRAYFORMULA()), but Google Sheets still requires the wrapper.
Frequently Asked Questions
Do I need to press Ctrl+Shift+Enter in Google Sheets?
No, you can type =ARRAYFORMULA() manually. Pressing Ctrl+Shift+Enter (or Cmd+Shift+Enter on Mac) is a shortcut that wraps your formula in ARRAYFORMULA() for you, but it’s not required.
Why is my array formula not spilling down?
If your formula returns multiple values but only shows one, you probably forgot to include ARRAYFORMULA(). Also, check that the cells below are empty. If there’s any content in the way, the spill will fail with a #REF! error.
Can I use array formulas with IF statements?
Yes, you can combine them. For example, =ARRAYFORMULA(IF(A2:A10>10, "High", "Low")) will return “High” or “Low” for each row. Just ensure the condition and the true/false values are arrays or single values.
What’s the difference between ARRAYFORMULA and MAP?MAP() is a newer function that applies a custom lambda function to each element in a range, while ARRAYFORMULA() is a general wrapper. For simple arithmetic, ARRAYFORMULA() is straightforward. For more complex logic, MAP() can be clearer.
Does ARRAYFORMULA work with VLOOKUP?
Not directly. VLOOKUP() expects a single lookup value, so you need to use ARRAYFORMULA() with IF() or use FILTER() instead. For example, =ARRAYFORMULA(VLOOKUP(A2:A10, D2:E10, 2, FALSE)) will actually work in Google Sheets because it returns an array of results—this is a special case that does work.
Can I use array formulas in Excel?
Yes, but differently. Excel uses dynamic arrays by default (since Excel 365), so you can write =A2:A10*B2:B10 and it spills automatically without a wrapper. In older Excel versions, you’d need to press Ctrl+Shift+Enter to create an array formula.
Related
- Explain Enum in Java: Syntax, Uses, and Examples
- K Value in Battery Testing: What It Means
- Solar Installation with Battery Calculator: How to Size
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Insert Rows in Excel Multiple Times: A Step-by-Step GuideTo insert several rows in Excel at once, select the same number of row headers as the number…
- Google Sheets Cell Validation: Rules, Lists, and TipsGoogle Sheets cell validation lets you control what people can enter in selected cells, using rules such as…
- Excel AutoSave: How to Turn It Off and Keep Changes SafeTo turn off AutoSave for the workbook you have open in Excel for Microsoft 365 on Windows, switch…
- Excel Dropdown: Remove Duplicate Options EasilyTo remove duplicate choices from an Excel dropdown, clean the list that feeds it: select that source list,…
- Remove Count from State Column in Excel: 3 WaysTo remove the count from the state column in Excel, you need to delete the COUNTIF formula (or…
- Check Track Changes in Word: Review Edits with ConfidenceTo check Track Changes in Word, open the Review tab, set Display for Review to All Markup, and…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.