Perform logical operations by using the SWITCH() function
=SWITCH(B2, "N", "North", "S", "South", "E", "East", "W", "West", "Unknown")Compare B2 with each case in turn and return the result beside the first exact match. The last, unpaired value is the default.
What the MO-211 task asks
SWITCH fits a task that maps codes to labels. In our MO-211 practice exams it reads like “set each film's price band from its Certificate: U and PG pay Family, 12A and 15 pay Standard, 18 pays Late. Anything else falls back to Standard.” A list of exact values, each with a result, and a fallback, is SWITCH.
“Anything else falls back to” is the default: one extra value at the end with no case in front of it. SWITCH only matches exactly, so a band such as “12 or more” is an IFS task, not a SWITCH one.
Our grader checks the value in every cell of the target range. It reads the values, not the function, so any formula that produces them earns the points — but one wrong cell fails the whole range.
Worked examples
Type these into a blank sheet to follow along. Every result below is what Excel showed.
| A | B | C | |
|---|---|---|---|
| 1 | Shipment | Code | Region |
| 2 | R-1 | N | North |
| 3 | R-2 | E | East |
| 4 | R-3 | W | West |
| 5 | R-4 | X | Unknown |
| 6 | R-5 | S | South |
| E | F | |
|---|---|---|
| 1 | Ticket | Priority |
| 2 | T-1 | 2 |
| 3 | T-2 | 1 |
| 4 | T-3 | 3 |
=SWITCH(B3, "N", "North", "S", "South", "E", "East", "W", "West", "Unknown")B3 holds E, the third case, so SWITCH returns the value paired with it.
=SWITCH(B5, "N", "North", "S", "South", "E", "East", "W", "West")X matches no case, and without a default there is nothing to return.
=SWITCH(F3, 1, "High", 2, "Medium", 3, "Low")The cases can be numbers. F3 holds 1, so the ticket is High.
=SWITCH(B2, "N", "Cold", "S", "Warm", "E", "Warm", "Mild")A result can appear more than once; each case still needs its own pair.
=SWITCH(B2, "N", "North", "S", "South", "E", "East", "W", "West", "Unknown")The default catches R-4's code X. This is what the video below builds.
Watch it done in Excel
The last example above, recorded in real Excel on the same grid.
Exam traps
“Anything else falls back to Standard” is the last, unpaired value. Leave it out and every code not in the list shows #N/A, as R-4 does with =SWITCH(B5, "N", "North", "S", "South", "E", "East", "W", "West").
SWITCH compares for equality only. =SWITCH(F4, ">2", "Low", "Other") returns Other for a priority of 3: it looked for the text >2. Bands are an IFS task.
=SWITCH(F3, "1", "High", "Other") returns Other, because F3 holds the number 1 and "1" is text. Write number cases without quotes.
Each pair is the case, then its result. =SWITCH(B2, "North", "N", "Unknown") returns Unknown for N: it was looking for the word North.
FAQ
Is SWITCH case-sensitive?
No. =SWITCH("n", "N", "North", "Unknown") returns North.
SWITCH or IFS?
SWITCH when one value is compared with exact cases, as with codes. IFS when each band is a comparison such as >= 20.
Can the default be a number?
Yes. =SWITCH(F2, 1, 10, 2, 5, 0) returns 5 for priority 2, and 0 for any priority not listed.
New to this function?
This page covers what the exam asks. For the full how-to — every argument, more examples and a practice workbook — read our guide on dfwexcel.com.
The SWITCH function, explained — dfwexcel.comTry it under exam conditions
Take a full, timed MO-211 practice exam, upload the workbook you built, and get a score out of 1000 with a per-task breakdown of where the points went. Your first one is free.
No credit card needed.
