Excel IF
IF checks a condition and returns one result when it is true and another when it is false.
A teacher has marks and needs a Pass or Fail beside each one. Deciding by eye is slow and inconsistent. IF writes the rule once, applies it to every student the same way and updates if a mark changes.
Practice it nowHow to write it
=IF(logical_test, value_if_true, [value_if_false])- logical_test
- A comparison that is TRUE or FALSE.
- value_if_true
- The result when true.
- value_if_false
- The result when false.
Watch it work
D2fx
ABCDE
1StudentScore
2Abe72
3Bea48
4Cal90
5Dee55
6Eve64
7
1
Examples
Did Abe pass?
=IF(B2>=50,"Pass","Fail")Pass72 meets the mark of 50.
Did Bea pass?
=IF(B3>=50,"Pass","Fail")FailThe same rule gives the other result.
Three possible results
=IF(B4>=85,"Distinction",IF(B4>=50,"Pass","Fail"))DistinctionA second IF handles the false case.
Your turn
Show Merit for Dee if her score is at least 60, otherwise Retake. Type your formula in D2.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Student | Score | ||
| 2 | Abe | 72 | ||
| 3 | Bea | 48 | ||
| 4 | Cal | 90 | ||
| 5 | Dee | 55 | ||
| 6 | Eve | 64 | ||
| 7 |
Common mistakes
Text without quotes.
Write "Pass", or Excel treats it as a name and returns #NAME?.
Many nested IFs.
They become hard to read. Use IFS or a lookup table.
Good to know
- Put the pass mark in a cell so the rule can change without editing formulas.
- Combine with AND or OR to test several things.
- IF or IFS? IF suits one decision. IFS is clearer when there are several outcomes.
Excelio