Home › Functions › Logical › IF
Logical function
IF function in Google Sheets
IF makes a decision. It checks a condition and returns one result when the condition is TRUE and another when it's FALSE. Most "smart" spreadsheets are built on it.
Syntax
=IF(logical_expression, value_if_true, [value_if_false])
logical_expressionA test that is TRUE or FALSE, e.g. C2>=70 or B2="A". value_if_trueWhat to return when the test is TRUE. value_if_falseOptional. What to return when it's FALSE (defaults to FALSE).
Practice IF
A score of 70 or higher passes. In C2 , show "Pass" or "Fail" for the first student.
Check answer
Hint
Show answer
↻ New data
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.
This interactive exercise needs JavaScript enabled.
IF examples
Each example below runs against this sample sheet. The results are calculated by the same engine as the practice grid.
Test scores (Ines missed the test)
Tips and common mistakes
Text comparisons are not case-sensitive: "a" = "A" is TRUE. Return "" (empty string) to leave a cell looking blank. For three or more outcomes, IFS is easier to read than nesting IF inside IF.
Related functions
Learning step by step? IF is covered in Lesson 6: IF Function of the free course.