Google Sheets Tips

ARRAYFORMULA in Google Sheets: how to use array formulas, with examples

ARRAYFORMULA makes one formula return a result for every row of a range. This guide works the syntax, calculations across columns, IF, VLOOKUP, SUMIF and COUNTIF inside an array formula, open-ended ranges, the functions that do not expand and the errors you will meet on one question: how does a report stay right when new rows are added?

Google Sheets TipsVadym Kramarenko16 min read

ARRAYFORMULA in Google Sheets: how to use array formulas, with examples

ARRAYFORMULA makes a formula that normally works on one cell work on a whole range and return a result for every row. Instead of writing =D2*E2 and copying it down, you write one formula in the first cell, =ARRAYFORMULA(D2:D13 * E2:E13), and the results fill the cells below.

You need Formula
Multiply two columns =ARRAYFORMULA(D2:D13 * E2:E13)
Join two columns as text =ARRAYFORMULA(B2:B13 & " - " & C2:C13)
A condition for every row =ARRAYFORMULA(IF(F2:F13 = "Refunded", 0, G2:G13))
Look up a whole list of keys =ARRAYFORMULA(VLOOKUP(C2:C13, Channels!A2:C5, 2, FALSE))
A total for each item of a list =ARRAYFORMULA(SUMIF(C2:C13, J2:J5, H2:H13))
Cover rows that are added later =ARRAYFORMULA(IF(A2:A = "", , D2:D * E2:E))

There is nothing to copy, and no row can end up with a different formula from the others.

That last point is why this page is worth a CIO’s five minutes. A business team builds a report in a sheet, it starts to feed decisions, and the question becomes whether the calculation in it can be trusted after the next paste: can one formula keep the report right when rows are added, without anyone re-copying formulas? It can. Every example below works on the same orders sheet and answers a smaller part of that question, and the one formula that answers it is in the section on rows that are added later.

Reading to get this done?

The question and the sheet

The question and the sheet

The sheet is an orders export from an online store, one order per row. The first ten rows were pasted on Monday, October 12, 2026; two more orders were pasted under them on Tuesday:

Column Holds
A Order date
B Order ID
C Channel the order came from: Paid search, Paid social, Email, Organic search, or nothing when the source was not recorded
D Units, empty for one order the export sent without a quantity
E Unit price
F Status: Paid or Refunded
G, H, I Revenue, kept revenue and the owner of the channel: one array formula each, in the header row

A second tab, Channels, lists each channel in column A, the team that owns it in column B and its cost center in column C.

A Google Sheets orders export with twelve rows: order date, order ID, channel, units, unit price and status, and three calculated columns, Revenue, Kept revenue and Owner. Cell G1 is selected and the formula bar shows ={“Revenue”; ARRAYFORMULA(IF(A2:A = “”, , D2:D * E2:E))}. Rows 12 and 13, the orders pasted on Tuesday, are highlighted and already have revenue of $1,047 and $295.

The formula sits in G1 only, and it also writes the column header:

={"Revenue"; ARRAYFORMULA(IF(A2:A = "", , D2:D * E2:E))}

The curly braces stack the word Revenue on top of the array result, so the formula sits above the data, where a sort or a paste into the order rows does not reach it. The two orders pasted on Tuesday, #10685 and #10688, already show $1,047 and $295. Nobody touched column G to get them.

Same report, two totals

Same report, two totals

Here is the same sheet the way most reports are built: =D2*E2 in G2, copied down to G11 on Monday. On Tuesday someone pastes the two new orders, and nobody copies the formula further.

The same orders sheet with a copied formula in G2 to G11 and nothing in G12 and G13, which are highlighted. Cell I2 holds =SUM(G2:G) and shows Revenue to date of $3,061.

The total in I2, =SUM(G2:G), reads $3,061. With the array formula in G1 it reads $4,403. Both are arithmetically correct. The difference, $1,342, is the two Tuesday orders, and nothing on the sheet says they are missing: there is no error, only a smaller number.

That is the case for ARRAYFORMULA in a shared report. The calculation is defined once, in one cell, so it can be read and checked once. Every row that arrives later gets the same calculation, and a person who types over a result breaks the formula visibly instead of quietly (see #REF! below).

Hand this to your AI

You copy the formula down every time new rows arrive, and the rows added since last week have none.

Paste this into your AI assistant. It writes one ARRAYFORMULA per column for your own sheet, with an open-ended range that covers every new row and leaves blank rows empty.

The prompt

replace the copied-down formulas in my sheet with one ARRAYFORMULA per column that fills new rows on its own and leaves blank rows empty

ARRAYFORMULA syntax

ARRAYFORMULA syntax

=ARRAYFORMULA(array_formula)

  • array_formula: a range, an expression that uses one or more ranges of the same size, or a function that returns more than one cell.

The function description in one line: it returns the values of a formula over a range instead of a single cell. Because the formula is never copied, its ranges need no $ signs, and there is no reason to press F4 to make references absolute.

There are two ways to enter it. Type the function name yourself, or write the inner formula and press Ctrl+Shift+Enter (Cmd+Shift+Enter on a Mac): Sheets wraps the formula in ARRAYFORMULA for you. Write =D2:D13 * E2:E13 in G2, press Ctrl+Shift+Enter, and the cell holds =ARRAYFORMULA(D2:D13 * E2:E13).

The cells the formula fills hold results, not formulas: you cannot edit them one by one, and if you type something into one of them, the array formula stops with a #REF! error because it has no room to expand.

Basic operations on columns

Basic operations on columns

Calculate across two columns

Any arithmetic works the same way as with single cells, with ranges in place of the cells: plus, minus, times, divided by. Revenue is the product of units and price on each row:

=ARRAYFORMULA(D2:D13 * E2:E13)

For the sum of the product of two columns in one cell, wrap the array in SUM, =SUM(ARRAYFORMULA(D2:D13 * E2:E13)), or use =SUMPRODUCT(D2:D13, E2:E13). Both return $4,403. To add two columns together row by row, use + in place of *.

Subtraction works the same way. With revenue in G and kept revenue in H, this returns the refunded amount on each row:

=ARRAYFORMULA(G2:G13 - H2:H13)

Two rows return $129 each, orders #10664 and #10679, $258 in refunds in all; the other rows return $0. The ranges have to be the same size, and each row of the result is calculated from the cells of the same row. Order #10673 came without a quantity, so its revenue is $0: a blank cell counts as zero in arithmetic. The formula is right, and the row is still wrong. The IF section below shows how to flag it.

Join columns as text

The ampersand joins text, and with ranges it joins row by row. To label every order with its channel:

=ARRAYFORMULA(IF(A2:A = "", , B2:B & " - " & C2:C))

Row 2 returns #10655 - Email. Row 4 returns #10661 - with nothing after the dash: that order has no channel, and the label shows it rather than hiding it.

Multiply two ranges cell by cell

The ranges can have several columns. Each cell of the first range is combined with the cell in the same position of the second one. On a Plan tab, the planned number of orders for November and December sits in B2:C5, one row per channel, and the planned average order value for the same months in D2:E5:

=ARRAYFORMULA(B2:C5 * D2:E5)

The result is a table of four rows and two columns: planned revenue per channel and month. Paid search, with 6 and 8 orders at $520 and $540, returns $3,120 for November and $4,320 for December. A table of rates, such as commission rates per channel and month, works the same way. This is element-by-element multiplication; for matrix multiplication in the mathematical sense, Sheets has the MMULT function.

ARRAYFORMULA with other functions

ARRAYFORMULA with other functions

IF: a condition for every row

Inside ARRAYFORMULA, IF runs an if-then test on every row of a range and returns a result for each. Kept revenue is the revenue of every order that was not refunded:

={"Kept revenue"; ARRAYFORMULA(IF(A2:A = "", , IF(F2:F = "Refunded", 0, G2:G)))}

The outer IF leaves the rows below the data empty; the inner one returns 0 for the two refunded orders. Kept revenue comes to $4,145, against $4,403 of revenue.

IFs can be nested further. This check column labels every order, so the rows a total should not be trusted on are visible before anyone adds them up:

=ARRAYFORMULA(IF(A2:A = "", "", IF(C2:C = "", "No channel", IF(D2:D = "", "No units", "OK"))))

On this sheet ten orders return OK, #10661 returns No channel and #10673 returns No units.

AND and OR do not work per row. They reduce the whole range to a single TRUE or FALSE, so =ARRAYFORMULA(IF(AND(G2:G13 > 500, F2:F13 = "Paid"), "Large", "")) returns one value for the whole range, a single yes or no. Multiply the conditions for AND and add them for OR:

=ARRAYFORMULA(IF((G2:G13 > 500) * (F2:F13 = "Paid"), "Large", ""))

Three orders are marked Large: #10670, #10682 and #10685. For OR, (C2:C13 = "Paid search") + (C2:C13 = "Paid social") is TRUE on every paid channel row.

VLOOKUP: look up a list of keys

VLOOKUP takes one search key. Inside ARRAYFORMULA it takes a range of keys and returns a result for each. Column I names the team that owns each order’s channel, from the Channels tab:

={"Owner"; ARRAYFORMULA(IF(A2:A = "", , IFNA(VLOOKUP(C2:C, Channels!A2:C5, 2, FALSE), "No owner")))}

  • C2:C: the channels to look up, one per order.
  • Channels!A2:C5: the table; the channels are in its first column.
  • 2: the column to return, the owner.
  • IFNA(…, “No owner”): order #10661 has no channel, so the lookup finds nothing. The row says No owner instead of #N/A, and the order stays in the report as its own line.

Change the index to 3 and the same formula returns the cost center:

=ARRAYFORMULA(IF(A2:A = "", , IFNA(VLOOKUP(C2:C, Channels!A2:C5, 3, FALSE), "No cost center")))

Who owns a channel is now written in one place, the Channels tab. When a channel changes hands, one cell changes, and every order on the sheet follows.

SUMIF: one total per item

SUMIF returns one total for one criterion. Give it a range of criteria inside ARRAYFORMULA and it returns one total for each of them. With the four channel names in J2:J5:

=ARRAYFORMULA(SUMIF(C2:C, J2:J5, H2:H))

The orders sheet with a summary block in columns J to L: kept revenue by channel. Cell K2 is selected and the formula bar shows =ARRAYFORMULA(SUMIF(C2:C, J2:J5, H2:H)). Paid search $2,094 (51%), Paid social $387 (9%), Email $553 (13%), Organic search $934 (23%), No channel $177 (4%), total $4,145.

The formula in K2 returns four totals, one next to each channel. The orders with no channel get their own line, =SUMIF(C2:C, "", H2:H), so they are neither dropped nor folded into the biggest channel:

Channel Kept revenue Share
Paid search $2,094 51%
Organic search $934 23%
Email $553 13%
Paid social $387 9%
No channel $177 4%
Total $4,145 100%

Because the ranges are open-ended, the next order pasted under row 13 lands in the right channel’s total without anyone touching the block.

SUMIF takes one condition. To sum by two columns with it, join the columns and compare them with a joined criterion. This formula adds up the revenue of Paid search orders that were not refunded:

=ARRAYFORMULA(SUMIF(C2:C13 & F2:F13, "Paid search" & "Paid", G2:G13))

  • C2:C13 & F2:F13: channel and status joined row by row, for example Paid searchPaid.
  • “Paid search” & “Paid”: the criterion in the same joined form.
  • G2:G13: the revenue to add up.

It returns $2,094. ARRAYFORMULA is required here: without it the joined range is not evaluated row by row. For a single total with several conditions, SUMIFS is the simpler tool and needs no ARRAYFORMULA: =SUMIFS(G2:G13, C2:C13, "Paid search", F2:F13, "Paid") returns the same $2,094.

SUMIFS does not expand. =ARRAYFORMULA(SUMIFS(H2:H, C2:C, J2:J5)) returns a single number, the total for the first criterion, with no error. For a column of totals use SUMIF as above.

COUNTIF: count several values at once

COUNTIF follows the same rule. With a list of criteria in curly braces it returns one count for each:

=ARRAYFORMULA(COUNTIF(F2:F, {"Paid", "Refunded"}))

It returns 10 and 2: the status column contains ten paid orders and two refunded ones, side by side, because the criteria are written as a row. Separate them with a semicolon, {“Paid”; “Refunded”}, to get the counts one under the other.

FILTER: no ARRAYFORMULA needed

FILTER already returns a range, so it works with or without ARRAYFORMULA around it. To list the Paid search orders that were not refunded:

=FILTER(B2:G, (C2:C = "Paid search") * (F2:F = "Paid"))

It returns three rows, #10658, #10670 and #10685, with their columns from order ID to revenue. The two conditions are multiplied, as in the IF example, so both must hold.

The same goes for removing blanks from a list. This returns the channel column without the empty cell of order #10661:

=FILTER(C2:C, C2:C <> "")

Wrap it in UNIQUE, =UNIQUE(FILTER(C2:C, C2:C <> "")), and the eleven values become the four channels. QUERY, UNIQUE, SORT and SEQUENCE also return ranges on their own.

CONCATENATE: everything into one cell

CONCATENATE does not work row by row. Inside ARRAYFORMULA it joins the whole range into a single cell, which suits a summary line such as the list of refunded orders:

=ARRAYFORMULA(CONCATENATE(IF(F2:F = "Refunded", B2:B & ": " & TEXT(G2:G, "$#,##0") & CHAR(10), "")))

  • IF(F2:F = “Refunded”, …, “”): keeps the refunded rows and returns nothing for the others.
  • B2:B & “: “ & TEXT(G2:G, “$#,##0”): order ID and amount for each row.
  • CHAR(10): a line break after each row.

The cell shows two lines, #10664: $129 and #10679: $129. For one joined value per row, use the ampersand as in the label example above. More on joining text in the guide to CONCATENATE and the ampersand.

Cover rows that are added later

Cover rows that are added later

This is the formula that answers the question. A range such as D2:D13 stops at row 13. To make the formula pick up new rows, leave the end of the range open and skip the empty rows:

=ARRAYFORMULA(IF(A2:A = "", , D2:D * E2:E))

  • A2:A, D2:D and E2:E: from row 2 to the bottom of the sheet. Column A holds the order dates, so a row counts as an order once it has a date.
  • IF(A2:A = “”, , …): returns nothing for rows where column A is empty, so the column is not filled with zeros down to the last row.

Put it in the header row as ={"Revenue"; ARRAYFORMULA(...)}, as in G1 above, and the whole calculation lives in one cell above the data. On this sheet that is the difference between $3,061 and $4,403 on Tuesday morning. The same pattern holds for kept revenue in H1, the owner in I1 and the channel totals in K2: four formulas, and the report is right however many orders are pasted under it.

An open-ended formula is calculated for every row of the sheet, including the empty ones. On a sheet with tens of thousands of rows and several such columns, a closed range that is a little longer than the data is faster.

ARRAYFORMULA errors

ARRAYFORMULA errors

#REF!: the result has no room

⚠️ Error: #REF! with the message that the array result was not expanded because it would overwrite data.

✅ Solution: One of the cells the formula needs to fill is not empty. Clear the cells below and to the right of the formula.

The orders sheet with #REF! in G1 and the error tooltip Array result was not expanded because it would overwrite data in G7. Cell G7, highlighted, holds the number 129 typed by hand, and the rest of column G is empty.

Here someone typed 129 into G7 by hand, perhaps to correct one order. The whole column stops, which is what a report owner wants: with copied formulas, a hand-typed number would have replaced one formula and nobody would have seen it. Delete the value in G7 and the column comes back.

A #REF! with “Unresolved sheet name” is a different problem: the formula points to a tab that does not exist or has been renamed, for example Channel!A2:C5 when the tab is called Channels.

An error in one row only

⚠️ Error: One row of the result shows an error such as #NUM! or #DIV/0!, and the others are fine.

✅ Solution: The error belongs to that row’s data. Revenue per unit, =ARRAYFORMULA(IF(A2:A = "", , G2:G / D2:D)), returns #DIV/0! on row 8, because order #10673 has no units. SQRT returns #NUM! the same way when its parameter is negative: there is no square root of a negative number. Fix the value, or wrap the calculation in IFERROR: =ARRAYFORMULA(IF(A2:A = "", , IFERROR(G2:G / D2:D, ""))). IFERROR hides the error, not the missing quantity, so keep the check column from the IF section next to it.

#N/A: wrong number of arguments

⚠️ Error: #N/A with “Wrong number of arguments to ARRAYFORMULA”.

✅ Solution: The parentheses are empty or contain more than one argument. ARRAYFORMULA takes exactly one.

Inside a lookup, #N/A has its usual meaning: the key was not found, as with the order that has no channel in the VLOOKUP example.

#ERROR!: the formula cannot be read

⚠️ Error: #ERROR! with “Formula parse error”.

✅ Solution: Look for a missing parenthesis, a missing quote or an operator with nothing after it, as in =ARRAYFORMULA(D2:D13 * E2:E13 +), which ends in a trailing plus sign.

#VALUE! without ARRAYFORMULA

⚠️ Error: A formula with ranges, such as =D2:D13 * E2:E13 or =LEN(C2:C13), returns only the value of its own row, or #VALUE! with the message “The default output of this reference is a single cell in the same row but a matching value could not be found. To get the values for the entire range use the ARRAYFORMULA function.”

✅ Solution: The function expects single values and received ranges. Wrap the formula in ARRAYFORMULA, or press Ctrl+Shift+Enter.

Only one result where a column was expected

⚠️ Error: The formula returns one value and no error.

✅ Solution: The function inside does not expand: AND, OR and SUMIFS reduce the range to one value. Replace AND and OR with multiplication and addition of conditions, and SUMIFS with SUMIF.

Related Google Sheets functions

Functions that are often used with or instead of ARRAYFORMULA, each with its own guide:

  • FILTER: Returns the rows that meet one or more conditions.
  • QUERY: Filters, sorts and summarizes a table with SQL-like syntax.
  • UNIQUE: Returns the distinct values of a range.
  • XLOOKUP: A lookup that can search in any direction.
  • INDEX and MATCH: A lookup built from two functions, for cases VLOOKUP does not cover.
  • Pivot tables: Summarize a table by category without formulas.
  • QUERY with UNIQUE: Combines SQL-like filtering with deduplication to return only the distinct rows that match a condition.
  • QUERY date filtering: Filters rows by a date or a date range inside a QUERY formula.

One formula per column is half the job

One formula per column is half the job

ARRAYFORMULA makes the calculation exact: one definition, every row, nothing left uncopied. The rows it runs on are the other half. When they are pasted in from an export, the formula calculates whatever is there: last week’s rows that nobody replaced, a column that shifted by one, numbers that arrived as text, an order exported without a quantity. The formula is exact; the rows may not be.

The OWOX Data Marts extension for Google Sheets covers that half. A data analyst publishes a Data Mart (a table or an SQL query in your data warehouse, with the definitions the team agreed, such as what counts as a refund) and makes it available for reports. In Sheets you open the extension, pick the Data Mart, tick the columns you want and run it. The rows land in a tab, ready for your array formulas.

Google Sheets with the OWOX Data Marts extension open beside an ad spend table: the Unified Ad Spend Data Mart, nine of fourteen columns ticked and a Save & Run button – the rows in the sheet come from a governed Data Mart, not a pasted export

What changes for the person who answers for the report:

  • Refresh replaces re-export. Refresh current report in the extension menu re-runs the same pull, and a scheduled refresh keeps the tab current without anyone touching it.
  • The source is written on the sheet. The header cell of an imported tab carries a note with the Data Mart it came from, the time of the import and a link to the report.
  • No SQL and no data warehouse access needed. The analyst decides which Data Marts and columns are available. Business users choose from that list.

The extension does not write or change the analyst’s SQL, and it does not replace ARRAYFORMULA: the header-row formulas above still define revenue, kept revenue and owner. They now run on rows that come from the same Data Mart on every refresh. The extension comes with the OWOX Cloud plans of OWOX Data Marts; spreadsheet reporting describes both ways data reaches a sheet.

Hand this to your AI

You copy the formula down every time new rows arrive, and the rows added since last week have none.

Paste this into your AI assistant. It writes one ARRAYFORMULA per column for your own sheet, with an open-ended range that covers every new row and leaves blank rows empty.

The prompt

replace the copied-down formulas in my sheet with one ARRAYFORMULA per column that fills new rows on its own and leaves blank rows empty

FAQ

Frequently Asked Questions

How to Use the ARRAYFORMULA Function in Google Sheets?

Write the calculation once with ranges instead of cells and wrap it in ARRAYFORMULA, or press Ctrl+Shift+Enter and Sheets wraps it for you. On an orders sheet with units in D and prices in E, `=ARRAYFORMULA(IF(A2:A = "", , D2:D * E2:E))` in G2 returns the revenue of every order. Put it in the header row as `={"Revenue"; ARRAYFORMULA(IF(A2:A = "", , D2:D * E2:E))}` and orders pasted later get their revenue with nothing to copy: on our example sheet the total is $4,403 instead of the $3,061 a copied formula shows.

Is it Possible to Combine Multiple Array Formulas in Google Sheets, and If So, How?

Yes. One ARRAYFORMULA can hold several functions nested inside each other, and one formula can stack several arrays with curly braces. Kept revenue nests two IFs: `={"Kept revenue"; ARRAYFORMULA(IF(A2:A = "", , IF(F2:F = "Refunded", 0, G2:G)))}` leaves empty rows blank and returns 0 for refunded orders. On our example orders sheet it comes to $4,145 against $4,403 of revenue. You do not need a second ARRAYFORMULA inside the first: one wrapper covers everything inside it.

How Do Array Formulas Interact with Other Functions in Google Sheets?

Functions that take one value, such as IF, VLOOKUP, SUMIF and COUNTIF, return one result per row or per criterion inside ARRAYFORMULA. `=ARRAYFORMULA(SUMIF(C2:C, J2:J5, H2:H))` returns kept revenue for four channels at once, Paid search $2,094 of $4,145 on our example sheet. Functions that already return ranges, such as FILTER, QUERY, UNIQUE and SORT, need no wrapper. AND, OR and SUMIFS do not expand: they return a single value, so multiply or add conditions and use SUMIF instead.

Are There Any Limitations or Common Errors to Be Aware of When Using Array Formulas in Google Sheets?

Yes. The cells the result needs must be empty: a number typed by hand into one of them stops the whole column with #REF!, "Array result was not expanded because it would overwrite data". In a shared report that is useful, because the edit is visible instead of silent. AND, OR and SUMIFS do not expand inside ARRAYFORMULA and return a single value; use multiplication of conditions and SUMIF instead. An open-ended range such as D2:D is calculated for every row of the sheet, which slows down large files.

What Is an Array Formula in Google Sheets?

An array formula is one formula that calculates a whole range and returns a result for every row, instead of one formula per cell copied down. In Google Sheets you write it with ARRAYFORMULA. On an orders sheet, `=ARRAYFORMULA(IF(A2:A = "", , D2:D * E2:E))` returns the revenue of each order, including orders added after the formula was written. The calculation lives in one cell, so it can be checked once and no row can end up with a different formula from the others.

How Can I Troubleshoot Issues with My Array Formulas in Google Sheets?

Read the message in the cell. #REF! usually means the result has no room to expand, for example a value typed into a result cell, so clear it. #VALUE! on a formula with ranges means ARRAYFORMULA is missing. #ERROR! is a typing mistake such as a missing parenthesis. An error in a single row comes from that row's data: an order without units returns #DIV/0! in a revenue-per-unit column. IFERROR hides the error, so flag the row as well, for example with a check column that returns No units.

How Do I Apply a Formula to a Single Cell in Google Sheets?

Type the formula with cell references, for example =D2*E2 for units times price, and press Enter. No ARRAYFORMULA is needed. A formula copied down a column covers only the rows it was copied to: on our example sheet, two orders pasted later were left out and the total read $3,061 instead of $4,403. To turn it into an array formula, replace the cells with open-ended ranges, `=ARRAYFORMULA(IF(A2:A = "", , D2:D * E2:E))`, or press Ctrl+Shift+Enter.

What Is the Inside Content of an ARRAYFORMULA Function?

Exactly one argument: a range, an expression that uses ranges of the same size, or a function that returns more than one cell. In `=ARRAYFORMULA(IF(F2:F = "Refunded", 0, G2:G))` the inside content is the IF, which returns 0 for refunded orders and the revenue for the rest. Empty parentheses or a second argument return #N/A, "Wrong number of arguments to ARRAYFORMULA". Functions inside the argument, such as VLOOKUP or SUMIF, take ranges where they normally take one value.

Who wrote this

Vadym Kramarenko

Vadym Kramarenko Growth Marketing Manager

Vadym Kramarenko is a Growth Marketing Manager at OWOX, where he drives user acquisition and product-led growth strategies. He hosts the OWOX podcast, interviewing analytics professionals about data-driven marketing, attribution, and reporting best practices. Vadym specializes in turning complex analytics concepts into practical, actionable marketing frameworks.