Google Sheets IF function
Returns one value if a condition is true and another if it is false.
Syntax
=IF(condition, value_if_true, [value_if_false])
condition | A test that is TRUE or FALSE, such as B2>=70. |
|---|---|
value_if_true | What to return when the test is TRUE. |
value_if_false | Optional. What to return when it is FALSE (default FALSE). |
Try it
Edit the formula and the result updates instantly. Click a cell to add its reference.
Test scores
Result: Pass
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Student | Score | Submitted | Min score | Grade | |
| 2 | Lily | 88 | TRUE | 0 | F | |
| 3 | Omar | 72 | TRUE | 60 | D | |
| 4 | Priya | 95 | TRUE | 70 | C | |
| 5 | Sam | FALSE | 80 | B | ||
| 6 | Tom | 64 | TRUE | 90 | A | |
| 7 | Uma | 59 | TRUE | |||
| 8 | Vic | 81 | TRUE |
Examples
These use the sample sheet above.
→ Pass
Lily scored 88, so she passes.
→ Fail
Uma scored 59.
→ B
IFs can be nested to handle more than two outcomes.
Tips & common mistakes
- Text results must be in "double quotes". Numbers and cell references must not be.
- Many nested IFs are hard to read. For grade bands, a VLOOKUP with a sorted table is often simpler.