Stacking IFs for Multiple Outcomes
Nest IF functions to grade or categorize values.
Stacking IFs for Multiple Outcomes is a free Excel Formulas Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Excel Formulas Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
One IF Is Not Always Enough
A single IF can only choose between two outcomes: the test is true, or it is false. But real data often has more than two categories. Think of letter grades A, B, C, D, F, or shipping tiers like Standard, Express, and Priority.
To handle three or more outcomes, you place one IF inside another. This is called nesting. The false branch of the first IF becomes the next decision, and so on, until every case is covered.
The Shape of a Nested IF
Every IF follows the pattern IF(test, value_if_true, value_if_false). To nest, you simply put another IF where the value_if_false goes.
Read this from left to right: if the first test passes, return its result; otherwise move on and ask the next question. The chain keeps narrowing down until one test finally matches.
=IF(test1, result1, IF(test2, result2, result3))A Grading Example
Suppose a score lives in cell A2 and you want a letter grade. You check the highest threshold first, then work downward. The last value is the fallback when nothing else matched.
Order matters: because 90 is also greater than 80, you must test the biggest number first or every high score would stop at the wrong branch.
=IF(A2>=90,"A",IF(A2>=80,"B",IF(A2>=70,"C","F")))Why Order Is Critical
Nested IFs stop at the first test that is true. If you tested A2>=70 first, a score of 95 would already be true there and return C by mistake.
Rule of thumb: when comparing with greater-than, test from the highest threshold down. When using less-than, test from the lowest up. The first match wins, so the most specific condition belongs first.
=IF(A2>=70,"C",IF(A2>=90,"A","F"))Reading a Chain Out Loud
A great trick for understanding any nested IF is to read it as a sentence:
- If the score is at least 90, the grade is A,
- otherwise if it is at least 80, the grade is B,
- otherwise if it is at least 70, the grade is C,
- otherwise the grade is F.
Each IF( is an "otherwise if" and the final value is the plain "otherwise".
Counting Your Parentheses
The number one source of errors in nested IFs is unbalanced parentheses. Every IF( needs a matching closing ) at the very end.
If you nest three IFs, you will have three closing parentheses stacked together: ))). Most spreadsheets highlight matching pairs in color as you type, so use that to confirm the count before pressing Enter.
=IF(A2>=90,"A",IF(A2>=80,"B",IF(A2>=70,"C","F")))Categorizing Text Values
Nested IFs work with text too, not just numbers. Imagine a region code in B2 and you want a full region name. You compare the cell to each code in turn.
Notice text comparisons need quotation marks on both the value you test against and the result you return.
=IF(B2="N","North",IF(B2="S","South",IF(B2="E","East","West")))Returning Calculations, Not Just Labels
The result of any branch can be a formula rather than a fixed label. This is how tiered discounts work. Here a sales amount in A2 earns a bigger discount as it grows.
Each branch multiplies the amount by a different rate, so one formula handles the whole pricing table.
=IF(A2>=1000,A2*0.2,IF(A2>=500,A2*0.1,IF(A2>=100,A2*0.05,0)))A Deeper Worked Example
Let us classify customer spend in A2 into loyalty tiers. We test from the top down so the highest qualifying tier wins:
5000or more becomes Platinum2000or more becomes Gold500or more becomes Silver- everything else is Bronze
Four outcomes need three nested IFs.
=IF(A2>=5000,"Platinum",IF(A2>=2000,"Gold",IF(A2>=500,"Silver","Bronze")))Knowing When You Have Too Many
Excel allows up to 64 nested IFs, but anything past three or four becomes hard to read and easy to break. Long chains are a warning sign.
When you find yourself stacking many IFs, it is usually time to switch to a cleaner tool such as IFS, SWITCH, or a lookup table. You will meet SWITCH in the next lesson.
Best Practices for Nesting
Keep nested IFs reliable with these habits:
- Always test thresholds in a consistent direction (high to low, or low to high).
- Provide a final fallback value so no case is left blank.
- Wrap text values and results in quotation marks.
- Count your closing parentheses before pressing Enter.
Follow these and even a three-deep IF stays trustworthy.
Quick Check
Test your understanding of nested IF ordering.
Recap: Stacking IFs
You learned to handle more than two outcomes by nesting one IF inside another's false branch. Key takeaways:
- The pattern is
IF(test, result, IF(test, result, fallback)). - Test thresholds in one consistent direction so the first match is correct.
- Always include a final fallback and balance your parentheses.
- Past three or four levels, reach for a cleaner tool instead.
=IF(A2>=90,"A",IF(A2>=80,"B",IF(A2>=70,"C","F")))Frequently asked questions
Is the “Stacking IFs for Multiple Outcomes” lesson free?
Yes — the full text of “Stacking IFs for Multiple Outcomes” is free to read here on the web, and the Excel Formulas Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Excel Formulas Academy course, upgrade to CoddyKit PRO.
What will I learn in “Stacking IFs for Multiple Outcomes”?
Nest IF functions to grade or categorize values. You practise Excel Formulas Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Excel Formulas Academy?
No prior experience is required. Excel Formulas Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Stacking IFs for Multiple Outcomes” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Excel Formulas Academy lesson?
Yes. Every Excel Formulas Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Stacking IFs for Multiple Outcomes
- Choosing Cases With SWITCH
- Picking Items With CHOOSE
- Keeping Complex Logic Readable