Category: FUNCTION | Updated: 2026-11-20
How to Use the IF Function in Google Sheets | Branch Values and Calculations Based on Conditions
How to Use the IF Function
The IF function is a logical function that evaluates whether a specified logical expression (condition) is TRUE or FALSE, returning different values or calculation results for each outcome.
Syntax
=IF(logical_expression, value_if_true, [value_if_false])
- logical_expression: A condition that evaluates to
TRUEorFALSE, such asA2>=80orB2="Completed"(required). - value_if_true: The value or formula to return when
logical_expressionisTRUE(required). - value_if_false: The value or formula to return when
logical_expressionisFALSE(optional; if omitted,FALSEis returned).
Table Example
Here is an example using the exam results table below to return "Pass" if the score is 80 or above, and "Fail" if it is below 80.
| Row | Column A (Name) | Column B (Score) | Column C (Result) |
|---|---|---|---|
| 1 | Name | Score | Result |
| 2 | Inoue | 85 | =IF(B2>=80, "Pass", "Fail") → Pass |
| 3 | Kimura | 72 | =IF(B3>=80, "Pass", "Fail") → Fail |
| 4 | Hayashi | 80 | =IF(B4>=80, "Pass", "Fail") → Pass |
- Formula:
=IF(B2>=80, "Pass", "Fail") - Explanation: Since
>=is the “greater than or equal to” comparison operator, cell B4 with a score of exactly 80 is also evaluated as"Pass".
Common Errors and Notes
- Forgetting double quotes around text (
#NAME?error): WritingPassinstead of"Pass"causes Sheets to mistake it for a function name or named range, resulting in a#NAME?error. - Incorrect comparison operator syntax: Write
>=for “greater than or equal to”,<=for “less than or equal to”, and<>for “not equal to”. Reversing the order (such as=>or=<) causes an error. - Omitting the third argument: If you omit
value_if_false, the wordFALSEwill be displayed whenever the condition is not met. If you want the cell to remain blank, specify""(an empty string) as the third argument (e.g.,=IF(B2>=80, "Pass", "")).
Frequently Asked Questions
Q. What is the rule for specifying text strings in an IF function's condition or result?
A. Text strings must always be enclosed in standard double quotes (""), such as "Pass" or "Tokyo". Double quotes are not needed when specifying numbers or cell references.
Q. Should I nest IF functions when I have three or more conditions?
A. While you can nest IF functions inside each other, too many conditions make formulas complex and error-prone. Using the IFS function is recommended for three or more conditional branches.