Category: FUNCTION | Updated: 2026-11-22
How to Use the ARRAYFORMULA Function in Google Sheets | Automatically Apply Formulas Across an Entire Range
How to Use the ARRAYFORMULA Function
The ARRAYFORMULA function lets you apply a calculation—normally performed on a single cell—across an entire cell range (array) at once, automatically spilling the results.
Syntax
=ARRAYFORMULA(array_formula)
- array_formula: A formula or function that operates on cell ranges (e.g.,
A2:A10orA2:A) (required). Entering it in just the top cell automatically spills the calculated results down the remaining rows.
Table Example
Here is an example of calculating row subtotals in Column D (using a single formula in cell D2) by multiplying Unit Price (Column B) by Quantity (Column C).
| Row | Column A (Product Name) | Column B (Unit Price) | Column C (Quantity) | Column D (Subtotal: Entered Only in D2) |
|---|---|---|---|---|
| 1 | Product Name | Unit Price | Quantity | Subtotal |
| 2 | Notebook | 200 | 5 | =ARRAYFORMULA(IF(B2:B="", "", B2:B * C2:C)) → 1,000 |
| 3 | Ballpoint Pen | 150 | 10 | (Auto-spilled) 1,500 |
| 4 | Clear Folder | 100 | 8 | (Auto-spilled) 800 |
| 5 | (Empty) | (Blank) | (Blank) | (Auto-spilled) (Blank) |
- Formula (cell D2 only):
=ARRAYFORMULA(IF(B2:B="", "", B2:B * C2:C)) - Result: D2 through D4 display each row’s product, while the empty row D5 remains blank. When new rows are added, there is no need to copy the formula down.
Common Errors and Notes
- Existing values in the spill range cause a
#REF!error: If any cell below the formula contains manual entries or another formula, an"Array result was not expanded"error occurs. Keep all cells below the formula cell empty. - Preventing zeros on blank rows: Using an open-ended range like
=ARRAYFORMULA(B2:B * C2:C)displays0on every empty row. Combining it withIF(B2:B="", "", ...)as shown in the example is the standard way to keep empty rows blank. - Some functions do not work inside
ARRAYFORMULA: Aggregation and certain functions such asSUM,SUMIFS,COUNTIFS,INDIRECT, andQUERYdo not expand row-by-row insideARRAYFORMULAand require alternative functions or operators.
Frequently Asked Questions
Q. Is there a keyboard shortcut to quickly wrap a formula in ARRAYFORMULA?
A. Yes. While editing a formula, press "Ctrl + Shift + Enter" on Windows or "Cmd + Shift + Enter" on Mac to automatically wrap the entire formula in ARRAYFORMULA(...).
Q. Why don't AND and OR functions calculate properly inside ARRAYFORMULA?
A. AND and OR collapse all values in an array into a single boolean, so they cannot evaluate row by row. Instead, use "(condition1)*(condition2)" for AND conditions and "(condition1)+(condition2)" for OR conditions.