Back to Functions

IF

Returns one value if a logical expression is `TRUE` and another if it is `FALSE`.

LogicalIF(logical_expression, value_if_true, value_if_false)

IF checks a condition and returns one value when it is true and another when it is false. It is the foundation of conditional logic in Google Sheets: flagging overdue invoices, assigning grades, calculating bonuses, showing a message only when something is missing.

Syntax

=IF(logical_expression, value_if_true, [value_if_false])
  • logical_expression: The test. Anything that evaluates to TRUE or FALSE, such as A1 > 10, B2 = "Paid" or ISBLANK(C3).
  • value_if_true: What to return when the test is TRUE.
  • value_if_false [Optional]: What to return when the test is FALSE. If you leave it out, IF returns FALSE (the word), which is rarely what you want. Pass "" to return an empty cell.

Basic examples

=IF(A1 > 10, "Greater than 10", "10 or less")

Returns text depending on the value in A1.

=IF(B2 = "Paid", "", "Send reminder")

Shows nothing for paid invoices and a reminder otherwise. Text comparisons are not case-sensitive, so "paid" matches "Paid".

=IF(C2 > 100000, C2 * 0.1, C2 * 0.05)

Returns a 10% commission above 100,000 and 5% otherwise. The results can be calculations, not just text.

Combining conditions with AND, OR and NOT

IF takes one test, but that test can combine several:

=IF(AND(B2 > 50, C2 = "Active"), "Qualified", "Not qualified")

AND requires all conditions. OR requires at least one. NOT reverses a result.

=IF(OR(D2 = "Gold", D2 = "Platinum"), "VIP", "Standard")

Nested IF: more than two outcomes

Put another IF in the false branch to handle further cases:

=IF(A1 >= 90, "A", IF(A1 >= 80, "B", IF(A1 >= 70, "C", "F")))

IF checks in order and stops at the first true condition, so the order matters: test the highest threshold first. Beyond three or four levels, nested IF gets hard to read and maintain. Use IFS instead, or a lookup table with VLOOKUP/XLOOKUP and approximate match.

Practical patterns

Handle blank cells

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

Leaves the result empty when the input is empty, instead of showing 0 or an error. You can also test with ISBLANK(A2).

Apply IF to a whole column

Wrap it in ARRAYFORMULA to fill every row from one formula:

=ARRAYFORMULA(IF(A2:A = "", "", IF(B2:B > 100, "High", "Low")))

Check for errors

=IF(ISERROR(A1 / B1), "n/a", A1 / B1)

For this pattern, IFERROR is shorter: =IFERROR(A1 / B1, "n/a").

Return a number or nothing

=IF(COUNTIF(A:A, E2) > 0, "Found", "Missing")

A quick way to check whether a value exists in a list.

Date comparisons

=IF(D2 < TODAY(), "Overdue", "On time")

Dates are numbers, so you can compare them directly.

Video Example

Common mistakes

  • Text without quotes. =IF(A1 = Paid, ...) gives #NAME?. Text must be in double quotes: "Paid".
  • Numbers in quotes. =IF(A1 = "10", ...) compares against the text "10". A cell containing the number 10 will not match. Write =IF(A1 = 10, ...).
  • Missing false branch. Leaving out the third argument returns FALSE. Add "" or another value.
  • Chained comparisons. =IF(5 < A1 < 10, ...) does not work. Use AND(A1 > 5, A1 < 10).
  • Wrong order in nested IF. Checking >= 70 before >= 90 makes every high score a C.
  • Wrong number of arguments. Usually a misplaced parenthesis or comma. Sheets highlights matching brackets as you type.

IF vs. IFS vs. SWITCH

  • IF: one test, two outcomes. Nest it for a few more.
  • IFS: a flat list of tests and results, easier to read than nested IF.
  • SWITCH: compares one expression against several exact values, with no ranges or comparisons.

Frequently asked questions

How many IFs can I nest? Sheets allows many levels, but readability drops quickly. Prefer IFS, SWITCH or a lookup table.

Can IF return a formula result? Yes. Either branch can be any expression, including other functions.

Can IF test several cells at once? Yes, with AND/OR, or with ARRAYFORMULA to apply the same test to a range.

Why does IF return FALSE instead of blank? The third argument is missing. Add "".

Related Functions

  • IFS: Test several conditions in order without nesting.
  • IFERROR: Replace an error with a fallback value.
  • SWITCH: Match one value against a list of cases.
  • AND: Check if all arguments are TRUE.
  • OR: Check if any argument is TRUE.
  • NOT: Reverse the logical value of an expression.

Related Articles

Newsletter

More IF examples coming soon.

We are building short, practical updates for Sheets power users.