Topic 10
Logical Functions
A logical question is any question with exactly two possible answers: YES or NO, TRUE or FALSE. Logical functions let you ask those questions inside a formula and return a different result depending on the answer.
What Does "Logical" Mean?
A logical question always has a yes/no answer. In Excel, every logical test returns exactly one of two values: TRUE or FALSE. You can't get "maybe."
- "Is this employee Full Time?" → TRUE or FALSE
- "Is the salary above 50,000?" → TRUE or FALSE
- "Is the rating equal to 5?" → TRUE or FALSE
IF then uses that TRUE/FALSE to decide which of two results to return. AND and OR combine multiple questions. IFERROR handles the case where a formula fails.
IF — The Foundation
Ask a question, get one of two answers depending on the result.
= <> > < >= <=
0 or "" for nothing, or nest another IF here for multiple outcomes.
Example — 500 bonus for Full Time, 0 for everyone else:
AND & OR — Combining Conditions
Both functions combine multiple logical tests and return a single TRUE or FALSE — which is then passed to an IF.
| Condition 1 | Condition 2 | Result |
|---|---|---|
| TRUE | TRUE | TRUE |
| TRUE | FALSE | FALSE |
| FALSE | TRUE | FALSE |
| FALSE | FALSE | FALSE |
| Condition 1 | Condition 2 | Result |
|---|---|---|
| TRUE | TRUE | TRUE |
| TRUE | FALSE | TRUE |
| FALSE | TRUE | TRUE |
| FALSE | FALSE | FALSE |
AND inside IF — bonus only for Full Time AND rating 5:
OR inside IF — bonus for Half-Time OR Hourly workers:
Nested IF — Multiple Outcomes
When there are more than two possible outcomes, you place another IF in the value_if_false position. Each inner IF handles the next level. Excel evaluates them in order — the first TRUE it finds wins.
IF(rating = 4, 1000,
IF(rating = 3, 750,
IF(rating = 2, 500,
0))))
). With 4 nested IFs you need 4 closing brackets at the end. Excel's colour coding helps — each opening bracket is a different colour matching its closing one.Instead of nesting, list all condition-result pairs. No closing bracket pyramid required.
[@[Job Rating]] = 4, 1000,
[@[Job Rating]] = 3, 750,
[@[Job Rating]] = 2, 500,
TRUE, 0) ← TRUE as the last condition = "everything else"
IFERROR — Handle Errors Gracefully
When a formula can't find a result — like VLOOKUP returning #N/A, or a division by zero giving #DIV/0! — IFERROR catches the error and returns a clean value instead.
"" for blank, 0 for zero, or a descriptive message like "Not found".
Example — clean up a VLOOKUP that might not find a match:
Practice — if.xlsx
Download if.xlsx| Employee | Status | Bonus |
|---|---|---|
| Nicholson, Lee | Half-Time | |
| Cole, Elbert | Full Time | |
| Allen, Thomas | Contract |
| Rating | Bonus |
|---|---|
| 5 | 1,500 |
| 4 | 1,000 |
| 3 | 750 |
| 2 | 500 |
| 1 | 0 |
IF([@[Job Rating]]=4, 1000,
IF([@[Job Rating]]=3, 750,
IF([@[Job Rating]]=2, 500, 0))))
| Employee | Rating | Bonus |
|---|---|---|
| Nicholson, Lee | 4 | |
| Allen, Thomas | 5 | |
| Palmer, Terry | 1 |
| Employee | Status · Rating | Bonus |
|---|---|---|
| House, Paul | Full Time · 5 | |
| Allen, Thomas | Contract · 5 | |
| Cole, Elbert | Full Time · 4 |