IFS, SWITCH and CHOOSE: Cleaner Than Nested IF
Rani's grade formula has four IFs inside each other and eight closing brackets. One missing bracket and nothing works. She rewrites it with IFS, maps branch codes to regions with SWITCH, and turns exam dates into financial-year quarters with CHOOSE.
IFS checks conditions in order and returns the value of the first TRUE one. SWITCH compares one value against a list of exact matches. CHOOSE returns the item at a given position (1, 2, 3...). IFS and SWITCH need Excel 2019 or later; CHOOSE works in every version.
Download the practice file (ifs-switch-choose.xlsx)
Excel file, 6 KB. It has the sample data used below. All numbers in this workbook are fictional teaching data, not real company figures.
Quick answer
- Slabs (marks, sales bands):
=IFS(B2>=85,"A",B2>=70,"B",B2>=50,"C",B2>=40,"D",TRUE,"Fail"). - Exact codes:
=SWITCH(D2,"PUN","West","NSK","North","Unknown"); the last lone value is the default. - Position:
=CHOOSE(MONTH(F2),"Q4","Q4","Q4","Q1",...)for April-March quarters. - Order IFS tests from the strictest to the loosest.
- End IFS with
TRUE,and a default, otherwise unmatched rows show #N/A.
=IFS(B2>=85,"A",B2>=70,"B",B2>=50,"C",B2>=40,"D",TRUE,"Fail")
=SWITCH(D2,"PUN","West","NSK","North","KOP","South","NGP","Vidarbha","SLP","South","Unknown")
=CHOOSE(MONTH(F2),"Q4","Q4","Q4","Q1","Q1","Q1","Q2","Q2","Q2","Q3","Q3","Q3")
Results on the practice data
| Student | Marks | Grade | Code | Region | Exam date | FY quarter |
|---|---|---|---|---|---|---|
| Ruhi | 91 | A | PUN | West | 12-05-2026 | Q1 |
| Zoya | 78 | B | NGP | Vidarbha | 03-08-2026 | Q2 |
| Amir | 64 | C | NSK | North | 20-10-2026 | Q3 |
| Raja | 49 | D | KOP | South | 15-01-2027 | Q4 |
| Rani | 35 | Fail | SLP | South | 30-06-2026 | Q1 |
| Salman | 83 | B | ABC | Unknown | 02-03-2027 | Q4 |
IFS: first TRUE wins
Compare with the nested IF: =IF(B2>=85,"A",IF(B2>=70,"B",IF(B2>=50,"C",IF(B2>=40,"D","Fail")))). Same answer, but IFS needs no stack of brackets.
Order matters
If you test B2>=50 before B2>=85, a 91 matches 50 first and gets C. Always start with the highest slab.
SWITCH: exact matches with a default
The regions here are a fictional company's sales zones. SWITCH looks at one value (the code) and returns the result paired with the matching code. Salman's code ABC is not in the list, so he gets the default Unknown. SWITCH cannot do ranges like >=70; use IFS or a lookup table for those.
More than 8 to 10 codes?
Put the codes in a two-column table and use XLOOKUP or VLOOKUP. A table is easier to update than a long formula.
CHOOSE: pick by position
MONTH(F2) gives 1 to 12. CHOOSE returns the 1st to 12th item from the list. Because the Indian financial year starts in April, months 1-3 (Jan-Mar) are Q4 and months 4-6 are Q1.
Other uses: =CHOOSE(WEEKDAY(A2),"Sun","Mon",...), or a scenario switch =CHOOSE(B1,low,mid,high) driven by a 1/2/3 drop-down.
Ravindra Bagale's Tip
When a formula maps codes to names, ask: will this list grow? If yes, use a small lookup table today. A SWITCH with 6 codes is neat; a SWITCH with 40 codes is a formula nobody wants to edit.
Ravindra Bagale's Tip – मराठी
Formula codes ला names देत असेल तर विचारा: ही list वाढणार आहे का? हो असेल तर आजच छोटी lookup table बनवा. 6 codes चा SWITCH छान दिसतो; 40 codes चा SWITCH कुणालाच edit करावासा वाटत नाही.
Ravindra Bagale's Tip – हिंदी
Formula codes को names दे रहा हो तो पूछिए: क्या यह list बढ़ेगी? हाँ हो तो आज ही छोटी lookup table बनाइए। 6 codes का SWITCH अच्छा लगता है; 40 codes वाला SWITCH कोई edit नहीं करना चाहता।
Practice task
- Open the Students sheet. Check the grades in column C.
- Change Raja's marks to 72 and check his grade becomes B.
- Change Salman's code to NGP and check the region.
- Change an exam date to 15-04-2027 and check the quarter is Q1.
- Rewrite C2 as a nested IF and compare.
Learn it properly
Course lessons:
Related guides: IF Function · LET Function in Excel: Name the Parts of a Long Formula · XLOOKUP for Beginners · IFERROR vs IFNA in Excel: Replace #N/A and #DIV/0! the Right Way
Frequently asked questions
Which Excel versions have IFS and SWITCH?
Excel 2019, 2021, 2024, Microsoft 365 and Excel for the web. Use nested IF or CHOOSE in Excel 2016.
How do I add a default value to IFS?
Make the last test TRUE and give the default after it: ...,TRUE,"Fail").
Can SWITCH test conditions like >=70?
Only with a trick (SWITCH(TRUE,B2>=70,...)). IFS is clearer for ranges.
Is CHOOSE the same as INDEX?
Similar: CHOOSE picks from items typed in the formula; INDEX picks from a range on the sheet.