Airtables

Writing an Airtable IF formula with AND, OR and blank checks

IF tests each record and returns one value for a match and another, or nothing, for the rest. Combine fields with AND, OR and NOT, catch empty fields without mistaking a 0 for one, compare numbers and dates without #ERROR, and decide when a nested IF should become a SWITCH.

A hinged metal sorting gate directs blank kraft envelopes toward one of two receiving trays.

An Airtable IF formula returns one value when a test is true and another when it's false: IF(test, value_if_true, value_if_false). Leave out the final value to show an empty cell when the test fails. Put AND or OR inside the test to combine conditions, and decide explicitly whether a numeric zero counts as a valid answer.

IF({Status} = "Ready", "Call the customer", "Not ready")

This formula produces text. A Ready record gets “Call the customer”; every other status, including an empty one, gets “Not ready.” It reads Status without changing it. I'd keep the original status as a single select, because a short list of agreed options is easier to maintain than several spellings of the same stage.

The examples use a bakery's Orders table: Status is a single select with Baking, Ready, Picked up and Cancelled; Paid is a checkbox; Deposit and Quantity are number fields; Unit Price is currency; Pickup Date is a date without a time. Each example belongs in its own Formula field. These formulas work on Free as well as paid plans; the formula field guide lists all plan types and Owner/Creator field-configuration access.

A formula applies to every record in its table. There's no fill-down step and no A1 reference: it reads field names from the same record. Bring a value from a related table into a lookup or rollup before using it here. A customer name typed into two tables won't establish that relationship.

The three parts of IF and where to type them

Read the formula as a sentence: “If Status equals Ready, show Call the customer; otherwise, show Not ready.” The first comma ends the test. The second separates the two possible results. Airtable's function reference defines this as IF(expression, value1, value2).

  1. Open the base table in a browser or the Mac or Windows app. Use an Owner or Creator account; this is table configuration, not an individual cell edit.
  2. Click + to the right of the last field, name the field Pickup message, and select Formula.
  3. Paste the complete formula above into the box below Formula. Replace Status and the option labels if your table uses different names.
  4. Click Create field. For an existing field, use its dropdown → Edit field, then Save. The field menu instructions also include Duplicate field for preserving a working formula before editing it.
Pickup message Formula field with a multiline IF that returns Call the customer for Ready and Not ready otherwise, above Create field.
Name the field Pickup message, select Formula and enter the complete IF expression. Click Create field to apply it to the table. View full size.

For the same output only on Ready records, use IF({Status} = "Ready", "Call the customer"). The blank-value instructions confirm that the false result can be omitted. Here are the expected results for three sample records:

StatusWith false valueFalse value omitted
ReadyCall the customerCall the customer
EmptyNot readyEmpty
CancelledNot readyEmpty
Airtable Orders grid: Status Ready, empty and Cancelled beside two IF formula fields, one returning Not ready and one leaving those cells empty
An empty Status is not Ready, so it takes the false branch like Cancelled does; leave the false value out and both of those cells stay empty.

“Not ready” is a deliberate fallback, not proof that someone assessed the order. If an empty Status needs attention, give it a separate result using the blank checks below.

Use curly braces for field references, straight quotes for text, and unquoted numbers for arithmetic: {Quantity} >= 12. Single-word field names can omit braces, but keeping them makes references clear. A renamed field updates its references automatically; a quoted label such as “Ready” remains literal text.

Don't add a spreadsheet-style equals sign before IF. Attach the opening parenthesis to the function name, write >= rather than =>, and close every parenthesis you open. A comparison by itself, such as {Quantity} >= 12, returns a Boolean value represented as 1 or 0; IF gives those outcomes the labels or calculations you choose.

Two conditions at once: AND, OR and NOT

AND requires every condition to be true; OR requires at least one. Each comparison is a complete argument inside the function. For an unpaid order ready for pickup, use this text result:

IF(
  AND({Status} = "Ready", NOT({Paid})),
  "Collect payment at pickup"
)
StatusPaidExpected result
ReadyUncheckedCollect payment at pickup
ReadyCheckedEmpty
EmptyUncheckedEmpty

NOT reverses its argument. An unchecked Paid checkbox makes NOT({Paid}) true; a checked one makes it false. Checkbox comparisons also accept 0 for unchecked and 1 for checked, so {Paid} = 0 is an alternative. The word “false” in quotes would be text, not an unchecked state.

Use OR when either completed status should close the order:

IF(
  OR({Status} = "Picked up", {Status} = "Cancelled"),
  "Closed",
  "Open"
)

Picked up and Cancelled return Closed. Baking returns Open. An empty Status returns Open too; if that would hide untriaged orders, wrap the expression in IF({Status}, ...), replacing the dots with the complete expression, or return a separate “Missing status” label.

Excluding both finished statuses requires AND: AND({Status} != "Picked up", {Status} != "Cancelled"). OR would pass even a Picked up record because it's not Cancelled. The AND version also passes an empty Status, so add {Status} as another AND argument when the field must be filled in.

For more involved rules, group alternatives inside the mandatory condition: AND(NOT({Paid}), OR({Status} = "Baking", {Status} = "Ready")). That means unpaid and in either of those two stages. Adding more commas to IF itself won't add outcomes; nesting supplies another decision.

XOR returns true when an odd number of its arguments are true. With two checkboxes that means exactly one is checked. With three, all three checked also returns true, so XOR isn't a general “exactly one selected” test.

When the test means “contains”

Equality checks the complete value. A substring search answers a different question. Suppose Order Notes is a single-line text field; this produces a text label when the notes contain “gift,” regardless of capitalization:

IF(FIND("gift", LOWER({Order Notes})), "Pack as gift")

FIND is case-sensitive, so LOWER normalizes the input; the reference specifies that no match returns 0. “Gift wrap” matches, an empty note doesn't, and “gifted” matches too. If you need an exact agreed category, use a single select and compare its complete option. A multi-select or a lookup with several linked values needs its own membership rule; a substring match alone can't prove that one exact option is selected.

Empty fields, BLANK() and the zero problem

A bare text or date field in the test asks whether it has a value. IF({Status}, "Status recorded", "Missing status") works for this Status field. IF({Status} = BLANK(), "Missing status", "Status recorded") asks the empty question first. The blank-value guide warns that != BLANK() can behave unexpectedly with nonnumeric fields, so I'd use the positive presence test or an explicit empty branch.

Number fields need more care. A bare {Deposit} test is false for both a missing deposit and a deposit of 0. The documented {Deposit} = BLANK() pattern also conflates those cases. Neither test tells you whether someone entered a zero deliberately.

IF(
  BLANK() = CONCATENATE({Deposit}, ""),
  "No deposit recorded",
  "Deposit on file"
)

This is the documented number-to-string blank check. An empty number becomes empty text; zero becomes the nonempty text “0.” The formula's result is text:

DepositExpected resultReason
20.00Deposit on fileA value is recorded
EmptyNo deposit recordedNo value is recorded
0.00Deposit on fileZero is recorded
Airtable Deposit check formula open beside the grid: Deposit 20.00 and 0.00 read Deposit on file, the empty Deposit reads No deposit recorded
Turn Deposit into text before the blank check: only a truly empty field becomes empty text, so a 0.00 deposit stays Deposit on file.

To distinguish a recorded zero from a positive payment as well, replace the last label with IF({Deposit} = 0, "Pay at pickup", "Deposit on file"). That inner IF only runs after the empty case has been handled. A negative deposit still needs a business decision; a presence check doesn't validate a refund or an adjustment.

For a completeness check, tell the next person what's missing. This text formula lists the fields needing attention; here the rule requires a positive Quantity, so zero deliberately fails:

IF(NOT({Status}), "Status\n") &
IF(NOT({Pickup Date}), "Pickup Date\n") &
IF(NOT({Quantity} > 0), "Positive quantity\n")

With Status and a positive Quantity filled in but no date, the result is Pickup Date. If all three pass, the result is empty. When Quantity is zero, the result includes Positive quantity. The conditional missing-field method puts each line break inside its IF so a satisfied check adds no empty line. Increase row height to read several lines.

This formula flags incomplete records; it doesn't prevent a record from being saved. Gate the next action on the completeness result if incomplete orders must stay out of a queue. A paid checkbox answers yes/no, not “has someone reviewed this?” Use a separate review status when those are different facts.

Leaving the cell empty instead of writing a label

Omitting the false result, returning BLANK(), and returning "" all display an empty cell in the examples above. For a calculated total, keep populated results numeric. A message such as “Missing price” in one branch mixes text and numbers and removes the field's uniform number-formatting options, as the formula formatting examples show.

For Orders, calculate only when Quantity is positive and Unit Price is recorded and nonnegative. A price of zero is valid:

IF(
  AND(
    {Quantity} > 0,
    NOT(BLANK() = CONCATENATE({Unit Price}, "")),
    {Unit Price} >= 0
  ),
  {Quantity} * {Unit Price}
)
QuantityUnit PriceExpected numeric result
123.5042.00
12EmptyEmpty
120.000.00

Set the result to Currency with two decimal places. The simpler AND({Quantity}, {Unit Price}) presence check would hide the zero-price total. This version rejects zero or negative quantities and negative prices; it accepts a positive fractional quantity, so add a separate whole-number rule if your items must be counted in units.

I'd keep any “Missing price” explanation in a separate text field, because calculations and human-readable validation have different readers. IF({Paid}, 1, 0) returns numbers; IF({Paid}, "1", "0") returns text. Appending empty text converts numbers to strings, which is useful for the blank check but unsuitable for a final currency value.

For division, guard the denominator, not just the numerator: IF({Goal} = 0, BLANK(), {Actual} / {Goal}). A positive Actual with a zero Goal would otherwise still divide by zero. The error guide identifies 0/0 as NaN and division by zero as the cause of Infinity.

Numbers and dates inside the test

Compare Number or Currency fields with unquoted numeric values. A single select option named “12” is still text. VALUE can convert a numeric string, but it isn't a substitute for defining Quantity as a number field. Percentages use fractional values: a threshold of 25% can be written {Discount} >= 0.25, or {Discount} * 100 >= 25; don't mix those scales. The numeric IF examples demonstrate the multiplication approach.

For date calculations, test that the required inputs exist before doing the calculation. The error guide uses IF(AND({Start}, {End}), DATETIME_DIFF({End}, {Start}, 'days'), BLANK()). Comparing a formatted date label as text isn't the same as comparing two Date fields.

For the sample date-only Pickup Date, flag an open order whose date is before today. Require Status as well, so an untriaged record doesn't silently enter the overdue queue. This returns text:

IF(
  AND({Pickup Date}, {Status}),
  IF(
    AND(
      IS_BEFORE({Pickup Date}, TODAY()),
      {Status} != "Picked up",
      {Status} != "Cancelled"
    ),
    "Overdue"
  )
)

A Ready order dated yesterday returns Overdue. An empty Pickup Date returns nothing; a Picked up order dated yesterday also returns nothing. A pickup dated today isn't overdue under this rule. IS_BEFORE compares the dates as documented in the date function reference.

Choose whether the deadline is a day or an instant. TODAY returns the current date; NOW includes the current time. For a time-enabled appointment, IS_BEFORE({Pickup Date}, NOW()) asks whether its exact time has passed. For local calendar-day labels, choose the business timezone and normalize the dates consistently; changing a display format alone doesn't define that rule. The date and timezone formatting guide covers that separate step.

Airtable refreshes TODAY and NOW when the base loads or the formula recalculates, and periodically while the base is open. In a closed base, the function reference describes an approximately hourly refresh when time-dependent automation or sync depends on it. Use a separate reminder automation when the condition should trigger a message.

Nested IF or SWITCH

A third outcome needs another decision in a result position. For positive Quantity values, this text formula selects a price band. Zero, negative and missing quantities remain empty:

IF(
  {Quantity} > 0,
  IF(
    {Quantity} >= 50,
    "Wholesale",
    IF({Quantity} >= 12, "Dozen rate", "Single")
  )
)
QuantityExpected resultWhy
60WholesalePasses the highest threshold
EmptyEmptyFails the positive-quantity guard
12Dozen rateFails 50, then passes the inclusive 12 boundary

49 returns Dozen rate and 50 returns Wholesale. Here the thresholds descend because each test uses >=. An ascending sequence using < also works. The order must agree with the operators; starting this formula with >= 12 would catch wholesale orders too early.

The nested IF instructions explain why each later test only sees records that failed the earlier tests. Don't write a chained comparison such as 12 <= {Quantity} < 50. For an independent middle-range test, use AND({Quantity} >= 12, {Quantity} < 50).

I'd keep IF for ranges, checkbox states and combined tests. When every branch compares the same field with a fixed category, SWITCH makes that mapping easier to read: name Status once, then list each option and its result. Returning a label doesn't update the original Status. If the mapping really belongs to related records, store it once in that related table instead of repeating a long formula everywhere.

When the editor rejects the formula or shows #ERROR

Start with the symptom. An invalid formula before saving usually needs syntax or field-name work; a failure in a few records points toward their inputs. The common formula errors guide identifies these causes and the display-setting case:

Invalid formula
Quotes, braces, commas, parentheses, field names. Retype straight quotes; keep IF( attached; check each test and both values.
Some records show #ERROR or NaN
Empty dates or text used in arithmetic. Guard the input; use the correct field type.
NaN or Infinity in a ratio
Zero denominator. Test Goal before dividing.
Circular reference
A field refers back to itself, directly or through others. Move the input to its own independent field.
No Currency formatting
A branch returns text. Keep populated outputs numeric.
Preview correct, grid blank
Single select output options. Add the missing option/fallback or turn that formatting off.

Each IF takes a test and at most two results. If you have four comma-separated arguments at the outer level, move the next decision into the false result. AND and OR produce Boolean values: putting one where you intended a message returns that Boolean rather than constructing another message branch.

If a long formula appears shorter after saving, preserve the full text outside the editor, then rebuild one branch at a time. Save, reopen and compare the complete expression, not just the first record's result. The nested IF guide specifically covers this recovery; a branch that fails to survive saving still needs attention.

Save the field and check three records

Open Edit field → Formatting before the final save. Numeric results offer Decimal, Integer, Currency, Percent or Duration. For text labels, “Change formula output to single select options” can style a predefined set; set a fallback so unexpected output stays visible. The current formula formatting instructions also support Checkbox output for recognized Boolean results such as {Status} = "Ready". The calculated checkbox follows the formula inputs. Alternative check-icon styles require a paid plan.

For a separate, editable checkbox, use an automation's Update record action to write to that field when the source status changes. Configure a checked and an unchecked outcome if the stored checkbox must follow changes in both directions.

Click Create field or Save, reopen the field, and check an ordinary record, a missing input and a boundary case from the tables above. For a price formula, include a real zero price; for bands, include exactly 12 and 50; for an overdue flag, include today and a finished order. Check any view, interface or automation that reads an existing formula before relying on the changed output.

Add a field description naming the source fields and the rule for missing values and zero. The next person should be able to read “Quantity must be positive; a recorded zero Unit Price is allowed” and predict the same total the saved field shows.