Data Analysis

ARRAYFORMULA(IF) in Google Sheets: Examples

Marc SeanNovember 9, 20267 min read
=ARRAYFORMULA(IF(condition_range, value_if_true, value_if_false))

For example, the following formula labels amounts of 100 or more as Review and leaves unused rows blank:

=ARRAYFORMULA(IF(A2:A4="","",IF(A2:A4>=100,"Review","OK")))

If A2:A4 contains 120, 80, and a blank cell, the results are Review, OK, and blank. Google documents how ARRAYFORMULA expands array results and how IF selects between true and false results.

How ARRAYFORMULA(IF) handles blank rows

To keep unused rows empty, put the blank-row check before the main calculation:

=ARRAYFORMULA(IF(A2:A11="","",your_logic))

The formula evaluates each row in this order:

  1. If the key cell in column A is blank, return an empty string.
  2. Otherwise, evaluate the conditional logic.
  3. Return one result for that row.

This structure prevents unused rows from receiving labels such as OK, UNPAID, or 0.

Keep in mind that a cell containing spaces isn’t blank. Remove the spaces, or use LEN(TRIM(A2:A11))=0 when whitespace-only inputs should also count as empty.

Here’s a reusable blank-safe pattern:

=ARRAYFORMULA(IF(key_range="","",IF(condition_range,result_if_true,result_if_false)))

Make sure the key, condition, and result ranges all cover the same rows.

Fix common ARRAYFORMULA(IF) errors

The array result could not expand

Clear the destination cells below the formula. Old formulas, pasted values, spaces, or other content can block the expanded results.

For example, if a formula entered in D2 covers rows 2 through 11, D3:D11 must be clear.

Referenced ranges have different sizes

Give every row-dependent range the same boundaries. Don’t mix A2:A11, B2:B10, and C2:C11.

Blank rows receive a status

Check that the blank test is the outermost IF:

=ARRAYFORMULA(IF(A2:A11="","",IF(...)))

If you check for blanks after the status logic, unused rows may reach another branch first.

The formula creates a circular reference

The array formula must not read from its own output range. A formula in D2 can read A2:C11, but it shouldn’t reference D2:D11.

Text is being treated as a valid financial input

Before comparing amounts, check whether they’re numeric. Avoid wrapping the entire calculation in IFERROR(...,0), because that can make malformed data look like a valid zero.

The formulas in this article use commas as argument separators. If your Google Sheets locale uses semicolons, replace the argument-separating commas with semicolons.

ARRAYFORMULA(IF) payment-status example

The following bounded example classifies orders as PAID, UNPAID, or PARTIAL while flagging invalid amounts.

Create a scratch sheet named ARRAYFORMULA Demo. Enter these headers in A1:D1:

ColumnHeading
AOrder ID
BOrder total (USD)
CPaid to date (USD)
DPayment status

Next, enter these illustrative inputs in A2:C4 and leave row 5 empty:

RowOrder IDOrder total (USD)Paid to date (USD)
2SO-104212500
3SO-1043800100
4SO-104421002100
5blankblankblank

Make sure D2:D11 is empty, then enter this formula in D2:

=ARRAYFORMULA(IF(A2:A11="","",IF((ISNUMBER(B2:B11)=FALSE)+(ISNUMBER(C2:C11)=FALSE),"CHECK INPUT",IF((B2:B11<0)+(C2:C11<0),"CHECK INPUT",IF(C2:C11>=B2:B11,"PAID",IF(C2:C11=0,"UNPAID","PARTIAL"))))))

Its branches run in this order:

  1. A blank order ID returns blank.
  2. A nonnumeric or negative amount returns CHECK INPUT.
  3. Paid-to-date greater than or equal to the order total returns PAID.
  4. Zero paid-to-date returns UNPAID.
  5. Any remaining valid row returns PARTIAL.

You should get these results:

CellExpected resultCheck
D2UNPAIDPayment is 0 and the total is positive
D3PARTIALPayment is above 0 but below the total
D4PAIDPayment equals the total
D5blankThe order ID is blank

These classifications match the corresponding sample orders in the verified companion workbook. However, the formula above is a separate teaching example, so reproduce and check it in the scratch sheet.

Check the boundary cases

Use a separate unused row for each check:

  • Total 0 and paid-to-date 0 returns PAID, because payment is greater than or equal to the total.
  • Total 100 and paid-to-date 125 returns PAID.
  • Text such as pending in either amount column returns CHECK INPUT.
  • A negative total or payment returns CHECK INPUT.
  • A blank order ID returns blank, even if other cells in that row contain values.

All references end at row 11. If you extend the model, update every referenced range to the same ending row.

Handling multiple conditions with nested IF

Use nested IF formulas when conditions have a defined priority. In the payment example, validation comes before classification, preventing text or negative inputs from reaching the PAID, UNPAID, or PARTIAL branches.

Although IFS can make mutually exclusive conditions easier to scan, it doesn’t remove the need for a blank-row check or input validation. Define the evaluation order first so the formula identifies exceptions before assigning normal statuses.

ARRAYFORMULA versus copied-down IF formulas

Both approaches can apply the same rule:

ApproachFormula placementMain trade-off
ARRAYFORMULA(IF(...))One formula controls the output rangeThe destination range must stay clear, and all source ranges must remain aligned
Copied-down IFEach supported row contains its own formulaNew rows need formulas copied or prefilled

Copied formulas are useful when selected rows need different logic, manual overrides, or independent formula auditing. In contrast, ARRAYFORMULA works well when one consistent rule should control a bounded range.

Neither approach guarantees correct classifications. Review the assumptions, source values, and exception results before relying on the output.

For more patterns, see ARRAYFORMULA in Google Sheets: Finance Guide and Google Sheets ARRAYFORMULA: Syntax, Examples, Fixes.

Optional portable order follow-up template

The companion workbook, ARRAYFORMULA(IF) Order Follow-up Template: Portable Prefilled IF Version, applies similar payment logic to an order workflow.

Copy this Google Sheets template or Download the Excel file.

Order decision summary above six sample orders and one unused supported row, showing editable inputs, calculated balances, payment states, and next actions.

The workbook uses prefilled row-level IF formulas in H10:J19, not a live ARRAYFORMULA. This separate example combines balance, payment, date, and stock rules in one sheet.

First, set Order Follow-up!B2 to the review date as an eight-digit YYYYMMDD integer. Replace records only in A10:G19, and preserve the formulas in H10:J19.

A recorded execution of the six synthetic sample orders produced an open balance of 3175 in B5 and an overdue amount of 1250 in D5. It also produced 1 overdue order in F5, 1 ready-to-ship order in H5, and 1 manual-review hold in J5.

Unused supported rows deliberately return 0 in H16:H19 and NO ORDER in I16:J19. These placeholders differ from the blank results produced by the teaching formula above.

The workbook doesn’t import orders, receive payments, send reminders, reserve inventory, or reschedule promised dates. You’ll need to update the source cells and carry out the identified actions manually.

Adapt the formula to your sheet

ModelMonkey can inspect spreadsheet context and help create or adjust formulas and cell content in Google Sheets or Excel. Check proposed formulas against your column layout, status definitions, and boundary cases. When the workflow presents a preview, review the changes before proceeding.

Use ModelMonkey to adapt the payment-status formula to your source columns and classification rules.

Frequently Asked Questions