What ARRAYFORMULA does
ARRAYFORMULA lets a formula work on a whole range instead of a single cell. Put the formula in the first result cell, wrap it in ARRAYFORMULA, and Google Sheets fills every row below it. The syntax is:
=ARRAYFORMULA(expression)
A basic example
Say column B holds the quantity, column C holds the unit price, and D1 holds the header Total. To multiply each row’s quantity by its price, enter this in D2:
=ARRAYFORMULA(B2:B*C2:C)
Sheets multiplies each pair of cells and fills D2 downward. The formula covers the whole range, so it also fills the empty rows below the data, and those rows show 0. The next example hides them.
Skipping blank rows
Wrap the calculation in an IF to show nothing when the quantity is blank:
=ARRAYFORMULA(IF(B2:B=“”, “”, B2:B*C2:C))
Rows with data show their totals, and empty rows show nothing.
Joining text across a range
ARRAYFORMULA also works with text. This joins two columns with a dash between them:
=ARRAYFORMULA(A2:A&” - “&B2:B)
Blank rows still show the dash, so add an IF like the one above if the list has empty rows.
Keeping the header out of the calculation
Type the header in D1 as plain text, and start the formula in D2. The header isn’t part of the calculation, and it stays at the top of the column.
The array result was not expanded error
If you see a message that the array result was not expanded, something is in the cells the formula needs to fill. The message names the first cell in the way. Clear that cell and the others below it, and the formula fills the range.
Functions that return arrays on their own
FILTER, SORT, UNIQUE and SEQUENCE return arrays without ARRAYFORMULA. For example, =FILTER(A2:C, B2:B=“Paid”) works by itself.
Many other functions that work on a range need the wrapper. IF is the most common one, which is why the examples above use it.
Keep the ranges bounded
Whole-column references, such as B:B, inside ARRAYFORMULA process every row in the sheet. On a large sheet, that can slow things down. When you know roughly how many rows you have, use a bounded range such as B2:B500.
Where to go next
If you need grouped totals rather than a column of results, a single QUERY formula often does the job. The query function google sheets examples show how to build one.