IF is the gateway to decision-making in Excel. It returns one value when a condition is true and another when it's false.
A spreadsheet categorizing results with conditional logic
1=IF(logical_test, value_if_true, value_if_false)1=IF(B2>=50, "Pass", "Fail")
2=IF(Sales>=Target, "🎯 Hit", "Below")
3=IF(Stock=0, "Reorder", "OK")| Operator | Means |
|---|---|
= | Equal to |
<> | Not equal to |
> < | Greater / less than |
>= <= | Greater/less or equal |
To grade A/B/C/F, put an IF inside the false slot of another IF:
1=IF(B2>=90,"A",
2 IF(B2>=80,"B",
3 IF(B2>=70,"C","F")))| Score | Grade |
| 95 | A |
| 83 | B |
| 71 | C |
| 55 | F |
Order matters in nested IFs — test from the top boundary down. Excel returns the first match, so >=70 before >=90 would label everyone "C".
Modern Excel offers IFS to avoid the parenthesis pile-up:
1=IFS(B2>=90,"A", B2>=80,"B", B2>=70,"C", TRUE,"F")Each pair is condition, result. The final TRUE,"F" acts as the catch-all "else".
1=IF(AND(Score>=50, Attendance>=0.75), "Pass", "Fail")
2=IF(OR(Region="North", Region="South"), "Domestic", "Other")
3=IF(NOT(Stock>0), "Out of stock", "Available")AND → all conditions must be true.OR → at least one true.NOT → flips true/false.