How to Use IF in Google Sheets

By Tomosuke Hasegawa · Updated Oct 29, 2026 · Beginner · 6 min read · includes 2 free exercises

In short: IF runs a test and returns one value when the test is TRUE and another when it is FALSE. The formula is =IF(logical_expression, value_if_true, value_if_false).

What IF does

IF lets a sheet make a decision. You write a test, such as "is this score at least 60?", and tell Sheets what to show when the answer is yes and what to show when it is no. It is the base for most other logic in a spreadsheet.

IF syntax

=IF(logical_expression, value_if_true, value_if_false)

Google's help page calls the order of the second and third arguments "the single most common source of problems" with IF, so check that the TRUE result comes first.

A step-by-step example

Here are four test scores in cells A1:B5.

AB
1NameScore
2Ann82
3Ben54
4Cara67
5Dev91

To show Pass for scores of 60 or more and Fail for anything lower:

=IF(B2>=60, "Pass", "Fail")

For Ann's score of 82 this returns Pass. Here is why:

  1. Sheets evaluates B2>=60. With 82 in B2, the answer is TRUE.
  2. Because the test is TRUE, IF returns the second argument, "Pass".
  3. For Ben's 54 the test would be FALSE, so the third argument, "Fail", would come back.

Text results go in quotation marks. Copy the formula down column C and each row is judged on its own score.

Comparison operators you can use

The test can use = (equal), <> (not equal), >, <, >= and <=. Text comparisons are also allowed, as in IF(A2="East", ...).

If you want a cell to stay visibly empty when the test fails, set the third argument to empty quotes: =IF(B2>80, "Top", "").

Nest IF for more than two outcomes

The third argument can be another IF. This gives grades A, B and C:

=IF(B2>=80, "A", IF(B2>=60, "B", "C"))

Sheets checks the first test, and only when it is FALSE does it move to the next one. Put the strictest test first. With many levels, IFS (which tests several conditions in order) is easier to read.

Common IF mistakes

Try it yourself

Use the score table above (A1:B5). Type your formula into the box, starting with =, then press Check.

Exercise 1: Pass or fail

In column C, write a formula for Ann's row (score in B2) that shows Pass when the score is 60 or more and Fail otherwise.

Hint: the test is B2>=60, then "Pass", then "Fail".

Exercise 2: Letter grade

For Cara's row (score in B4), write a nested IF that returns A for 80 or more, B for 60 or more, and C otherwise.

Hint: put a second IF in the third argument.

What to learn next

Syntax and rules in this guide were checked against Google's IF help page. See all guides.