IFS & SWITCH practice exercises
5 graded problems with realistic data, all medium.
Two ways to avoid a long chain of nested IFs: IFS checks a list of conditions in order, SWITCH matches one value against a list of possibilities. The 5 exercises below come from LearnExcel's practice library. Each one gives you a realistic table, a cell to fill, and a hint if you get stuck. Read them here, then solve them in the interactive grid, where your formula is checked the moment you press Enter.
New to the function? Read the IFS & SWITCH guide first: syntax, a worked example and the mistakes people make.
In this set
- Assign a letter grade with IFS
- Assign a shipping tier with IFS
- Map a number to a name with SWITCH
- Use SWITCH with a fallback value
- Choose between IFS and SWITCH for the right job
The exercises
Assign a letter grade (A/B/C/F) to a test score of 85, using the usual 90/80/70 cutoffs.
| A | B | |
|---|---|---|
| 1 | Score | 85 |
| 2 | ? |
Enter a formula in A2.
Show a hint
IFS checks each condition in order and returns the first TRUE one's result; end with TRUE as a catch-all: =IFS(B1>=90,"A",B1>=80,"B",B1>=70,"C",TRUE,"F").
IFS replaces a deeply nested IF(IF(IF(...))) with a flat, much more readable list of condition/result pairs: the same logic, far easier to read back later.
Assign a shipping cost tier based on order weight: under 1 kg is "Small", under 5 kg is "Medium", otherwise "Large". The order weighs 3.2 kg.
| A | B | |
|---|---|---|
| 1 | Weight (kg) | 3.2 |
| 2 | ? |
Enter a formula in A2.
Show a hint
=IFS(B1<1,"Small",B1<5,"Medium",TRUE,"Large"), IFS stops at the first condition that's TRUE, so order the cutoffs smallest-first.
A tiered rule like this is exactly where nested IFs get hard to read: IFS keeps each tier's condition and result sitting right next to each other.
Turn a day number (1 through 7) into its name. Day 3 should show "Wednesday".
| A | B | |
|---|---|---|
| 1 | Day number | 3 |
| 2 | ? |
Enter a formula in A2.
Show a hint
SWITCH(value, match1, result1, match2, result2, ...) checks value against each match in turn: =SWITCH(B1,1,"Monday",2,"Tuesday",3,"Wednesday",...).
SWITCH is the right tool whenever you're mapping one value to another exact value: a code to a name, a number to a label, rather than testing a range of conditions like IFS does.
Map a status code (1, 2, or 3) to a label, and show "Unknown" for any other code. The code is 9.
| A | B | |
|---|---|---|
| 1 | Status code | 9 |
| 2 | ? |
Enter a formula in A2.
Show a hint
A final, unpaired argument acts as the default when nothing matches: =SWITCH(B1,1,"Open",2,"Closed",3,"Pending","Unknown").
Without that trailing default, SWITCH returns an error for anything it doesn't recognize: exactly the kind of case real data (a typo, a new code nobody added yet) eventually hits.
A size code of 2 maps to "Medium" (an exact-match lookup, not a range). Write a formula to find the size name.
| A | B | |
|---|---|---|
| 1 | Size code | 2 |
| 2 | ? |
Enter a formula in A2.
Show a hint
This is matching exact values, not testing ranges like score>=90; that's SWITCH's job, not IFS's: =SWITCH(B1,1,"Small",2,"Medium",3,"Large").
The rule of thumb: IFS for a list of true/false conditions (often ranges), SWITCH for "does this value exactly equal one of these options"; picking the wrong one just means more typing, not a wrong answer, but the right one reads better.
Solve these in a real grid
Type your formula, get graded instantly. Your first 10 exercises are free, no signup.
Start the IFS & SWITCH exercises →