IF Function in Google Sheets
Learn how to use the IF function in Google Sheets to return different values based on whether a condition is true or false.
IF(logical_expression, value_if_true, value_if_false) The IF function in Google Sheets tests a condition and returns one value when the condition is TRUE and another when it is FALSE. It is the foundation of all conditional logic in Sheets.
You use IF whenever a cellโs value should depend on some other value. Pass/fail labels, status indicators, tiered categories โ anything where the output changes based on a condition starts with IF.
Syntax
=IF(logical_expression, value_if_true, value_if_false)
Parameters
| Parameter | Required | Description |
|---|---|---|
logical_expression | Yes | The condition to evaluate. Must resolve to TRUE or FALSE. |
value_if_true | Yes | The value returned when the condition is TRUE. Can be a number, text, formula, or cell reference. |
value_if_false | Yes | The value returned when the condition is FALSE. Can be a number, text, formula, or cell reference. |
If you omit value_if_false, Google Sheets returns FALSE by default when the condition is not met. You can pass an empty string "" to return a blank cell instead.
Examples
Basic pass/fail
Check whether a score in B2 meets a passing threshold of 70:
=IF(B2>=70, "Pass", "Fail")
If B2 contains 85, this returns โPassโ. If B2 contains 60, it returns โFailโ.
Nested IF for letter grades
Assign a letter grade based on a score in B2:
=IF(B2>=90, "A", IF(B2>=80, "B", IF(B2>=70, "C", "F")))
Google Sheets evaluates from left to right. A score of 82 fails the first condition (not >= 90), passes the second (>= 80), and returns โBโ. For more than three tiers, consider using IFS instead โ nested IF formulas get hard to read fast.
Conditional calculation
Apply a 10% discount when the order total in C2 exceeds $100:
=IF(C2>100, C2*0.9, C2)
If C2 is $150, this returns $135. If C2 is $80, it returns $80 unchanged.
Common Errors
Formula parse error This happens when you leave out a required argument. IF needs all three parameters to work predictably. If you see a parse error, check that you have a condition, a true value, and a false value separated by commas.
=IF(B2>=70, "Pass")
This technically works (returns FALSE when the condition fails), but it almost never produces the result you want. Always include the third argument.
#ERROR! from mismatched quotes If your text values contain quotes or apostrophes, the formula breaks. Wrap text values in double quotes and avoid unescaped characters inside them.
Tips
Use "" as the false value when you want the cell to appear blank instead of showing FALSE. This keeps your sheet clean, especially in columns where only some rows meet the condition.
When you find yourself nesting more than three IF functions, switch to IFS. It handles multiple conditions in a flat list, which is easier to read and debug.
Want to go deeper?
Check out our full tutorials for step-by-step examples and real-world use cases.
Published February 19, 2026