IF Function in Google Sheets (Syntax and Examples)

IF returns one result when a condition is true and another when it is false. Use it for labels, conditional calculations, and decisions involving several criteria.

Start with a condition you can check independently. Then write both possible results explicitly so the formula’s behavior is clear, including at boundaries and for missing inputs.

IF function syntax

=IF(logical_expression, value_if_true, [value_if_false])
  • logical_expression: a comparison or expression evaluated as TRUE or FALSE.
  • value_if_true: the value, text, or calculation returned when true.
  • value_if_false: the result returned when false; specify it explicitly in practical formulas.

The Google IF reference describes the function arguments.

Example data

Enter this dataset starting in A1. Leave cells marked “leave empty” empty; type any displayed formula as a formula. Keep a separate blank area for the results.

StudentScoreAttendance
Maya920.95
Noah550.9
Ari750.7
Lena600.9
Omar(leave empty)0.8

The examples below use this dataset unless the formula supplies its own values. Array results need enough empty cells to expand. The formulas use commas as argument separators. Your spreadsheet locale may require semicolons.

Return a pass or fail label

A score of at least 60 passes. Maya’s score of 92 returns Pass.

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

Result: Pass

IF formula and its calculated result beside the bordered example data.

The >= operator includes the boundary, so exactly 60 also passes.

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

Result: Pass

Perform a calculation conditionally

This formula awards 10% of 1200 because the amount exceeds 1000. Otherwise it returns zero. A cell reference can replace each repeated amount.

=IF(1200>1000,1200*0.1,0)

Result: 120

Assign a grade with nested IF

The formula checks the highest threshold first, then proceeds to lower bands. The first true condition determines the result.

=IF(B2>=90,"A",IF(B2>=75,"B",IF(B2>=60,"C","D")))

Result: A

Require all conditions or allow either one

AND requires both a score of at least 60 and attendance of at least 80%.

=IF(AND(B2>=60,C2>=0.8),"Eligible","Not eligible")

Result: Eligible

OR accepts either condition. Noah qualifies here because attendance is 90%, even though the score is below 60.

=IF(OR(B3>=60,C3>=0.8),"Eligible","Not eligible")

Result: Eligible

Handle a missing score

Comparing the score cell with an empty string catches a blank value and returns No score.

=IF(B6="","No score",B6)

Result: No score

Apply the rule down a column

ARRAYFORMULA evaluates each score in B2:B6. The outer IF leaves a missing score’s result visually empty instead of assigning it a pass or fail label.

=ARRAYFORMULA(IF(B2:B6="","",IF(B2:B6>=60,"Pass","Fail")))
Pass
Fail
Pass
Pass
(empty string)

Other Google Sheets articles you may also like