The IF function
Returns one value when a test is TRUE and another when it is FALSE. Put text results in double quotes.
Syntax
IF(logical_test, [value_if_true], [value_if_false])- logical_test
- A comparison that is TRUE or FALSE, such as A2>=50.
- value_if_true (optional)
- What to return when the test is TRUE.
- value_if_false (optional)
- What to return when the test is FALSE.
Examples
C1
=IF(1A2>=50,2"Pass",3"Fail")| A | B | C | |
|---|---|---|---|
| 1 | Score | Pass | |
| 2 | 62 |
In plain words: 1If the score in A2 is 50 or more, 2show Pass. 3Otherwise show Fail.
C1=IF(A2>100,A2*0.1,0)
| A | B | C | |
|---|---|---|---|
| 1 | Score | 0 | |
| 2 | 62 |
Practice IF
Read the guide
Questions
How many IFs can I nest?
Excel allows 64, but past three or four the formula is hard to read. Use IFS, or a lookup table with VLOOKUP or XLOOKUP, instead.