
📎 This article includes 1 downloadable practice file ↓
Grades, commission slabs, eligibility checks, status labels: decision formulas are everywhere, and they’re where silent mistakes hide. The rules below keep them correct and readable.
In this article
Nested IF: strictest first
=IF(B2>=90, "A+", IF(B2>=75, "A", IF(B2>=60, "B", IF(B2>=40, "C", "F"))))
Excel stops at the first TRUE. Put the highest threshold first; if you test B2>=40 first, everyone with 40 or more gets “C”.
IFS: the same, flatter (Excel 2019+)
=IFS(B2>=90, "A+", B2>=75, "A", B2>=60, "B", B2>=40, "C", TRUE, "F")
The final TRUE, "F" is the catch-all; without it, unmatched values return #N/A.
AND and OR
=IF(AND(B2>=40, C2>=75%), "Eligible", "Not eligible") ' marks AND attendance
=IF(OR(D2="Gold", E2>500000), "Priority", "Standard")
=IF(AND(B2>=40, OR(C2>=75%, F2="Medical")), "Eligible", "Not eligible")
SWITCH for exact matches
=SWITCH(A2, "N", "North", "S", "South", "E", "East", "W", "West", "Unknown")
When to stop nesting: a lookup table
More than four levels, or thresholds that change every year (tax slabs, commission rates)? Put them in a table and use an approximate lookup:
=XLOOKUP(B2, Bands[From], Bands[Grade], , -1)
=VLOOKUP(B2, $H$2:$I$6, 2, TRUE)
Changing a threshold then means editing a cell, not rewriting formulas. See approximate match for slabs.
IFERROR and IFNA, carefully
=IFNA(XLOOKUP(A2, Codes, Names), "Code not found") ' only #N/A
=IFERROR(B2/C2, 0) ' any error
Where people go wrong
| Mistake | Effect |
|---|---|
| Lowest threshold first | Everyone lands in the first band |
| “>=40” typed as text | Comparisons fail; write B2>=40 |
| Blank cells | Blank counts as 0 → “F”; add IF(B2=””,””,…) |
Test formulas dynamically in our web formula laboratory or download the companion Excel workbook.
📎 Practice files for this article
- 📗IF / IFS / IFERROR scenarios workbookGrades and eligibility with nested IF, IFS, a band table and IFERROR — PASS/FAIL checks plus three mistakes that give wrong grades silently.⬇ XLSX · 8 KB
Free to use for learning. Files with macros (.bas) are plain text — import them with Alt+F11 → File → Import File, and always test on a copy.
Atul (AJ) builds office-automation and local-first AI tools as Atulya AI, and works with Excel, SAP and Oracle EPM every day. He writes about the shortcuts, macros and automations that actually save time — plus the occasional wacky fact. Videos on YouTube: Lazy Automator AI (@LazyAutomatorAI).
More posts by Atul →Stuck on a step? Ask a question and the AI answers using this article.