SheetsLessons
Lesson 6 · Logic

IF Function

Practice the IF function in Google Sheets: test a condition and return different results. Interactive exercises with instant feedback.

Task 1 of 3

A score of 70 or higher passes. In C2, show "Pass" or "Fail" for the first student.

C2
fx

Tip: while typing a formula, click a cell or drag across cells to insert references. Press Enter to check, and Tab to accept a function suggestion.

Making decisions with IF

IF checks a condition and returns one thing when it's TRUE and another when it's FALSE.

=IF(logical_expression, value_if_true, [value_if_false])

The condition is usually a comparison:

OperatorMeaning
=equal to
<>not equal to
> / <greater / less than
>= / <=greater / less than or equal to

Text results go in double quotes: =IF(B2>=70, "Pass", "Fail"). To leave a cell looking empty, return an empty string "".

The results can be calculations too: =IF(B2>C2, B2*0.05, 0).