Sheetsdrill

Logical Updated November 2026

IF

IF(logical_expression, value_if_true, value_if_false) tests a condition and returns the second argument when it is TRUE and the third when it is FALSE. Conditions use =, <>, >, <, >=, <= and can be combined with AND, OR and NOT.

Syntax

=IF(logical_expression, value_if_true, [value_if_false])
PartWhat it is
logical_expressionA comparison or anything that evaluates to TRUE or FALSE, for example B2>1000 or A2="Paid".
value_if_trueWhat to return when the condition holds: text in quotes, a number, a cell or another formula.
value_if_falseOptional. What to return otherwise; FALSE if omitted.

Examples

=IF(B2>C2, "Over budget", "OK")

Result: Over budget when spend exceeds budget, otherwise OK

=IF(A2="", "", B2*C2)

Result: Blank when A2 is empty, otherwise the product

The standard way to keep formulas from showing 0 on empty rows.

=IF(B2>=10000, B2*0.05, 0)

Result: 500 for a sale of 10000, 0 for a sale of 9999

Common mistakes

  • Comparing text without quotes (=IF(A2=Paid, ...)) gives #NAME?; write "Paid".
  • A condition like B2>"100" compares against text and gives unexpected results; use the number 100 without quotes.
  • Using IF(A2=TRUE, ...) on a checkbox works, but IF(A2="TRUE", ...) does not because the checkbox is a boolean, not text.

Practice IF

These drills check your answer on live data, free, no account needed.

  • Over budget?If the actual cost is higher than the budget, the status is "Over". Otherwise it is "OK". Fill D2 and D3.
  • Commission over a thresholdA rep earns the rate in F2 on all sales, but only when sales reach at least the threshold in F1. Below it the commission is 0. Fill C2 and C3 with formulas that could be filled down.
  • Price after discountApply the discount in B2 to the list price in B1 and round the sale price to cents. Answer in B3.

Questions

How do I write an IF with multiple conditions?

Wrap them in AND or OR: =IF(AND(B2>1000, C2="West"), "Yes", "No") or =IF(OR(A2="Paid", A2="Refunded"), 1, 0).

How do I check if a cell is blank?

=IF(ISBLANK(A2), "Missing", "OK") or =IF(A2="", "Missing", "OK"); the second also treats a formula returning "" as blank.

Related

  • IFSHow the IFS function in Google Sheets checks several conditions in order and returns the first match, with examples for grades, tiers and bands, plus errors.
  • AND and ORHow AND and OR work in Google Sheets to test several conditions at once, how to use them in IF, and why they fail inside FILTER and ARRAYFORMULA, with fixes.
  • IFERRORHow IFERROR in Google Sheets hides errors like #N/A, #DIV/0! and #VALUE! with a blank, a zero or a message, with examples for VLOOKUP and division.
  • SWITCHHow SWITCH in Google Sheets compares one expression against a list of cases and returns the matching value or a default, with examples for codes and regions.

Previous: HLOOKUPNext: IFS