SheetsLessons
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_expression
A test that is TRUE or FALSE, e.g. C2>=70 or B2="A".
value_if_true
What to return when the test is TRUE.
value_if_false
Optional. What to return when it's FALSE (defaults to FALSE).

Practice IF

Task 1 of 4

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.

IF examples

Each example below runs against this sample sheet. The results are calculated by the same engine as the practice grid.

ABCD
1StudentClassScorePassed
2PriyaA92TRUE
3LeoB67FALSE
4ChloeA48FALSE
5MateoB81TRUE
6InesCFALSE
7KaiC75TRUE
Test scores (Ines missed the test)
FormulaResultWhat it shows
=IF(C2>=70, "Pass", "Fail")PassText results go in double quotes.
=IF(C4>=70, "Pass", "Fail")FailSame test on a different row.
=IF(ISBLANK(C6), "Missing", C6)MissingHandle empty cells gracefully.
=IF(B2="A", C2*1.1, C2)101.2Results can be calculations: a 10% curve for class A.

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