
Compare one expression against a list of values and return the matching result.
The Excel SWITCH function compares one expression against a list of values and returns the result for the first match. It is especially helpful when you want to map known codes, labels, or categories to clearer outputs.
One reason SWITCH is easier to read than some alternatives is that the expression only appears once. After that, you list the possible matches and the result for each one. This can make code-to-label formulas much cleaner than a long chain of IF statements.
Use SWITCH when you know the possible values you want to match and the result each one should return.
SWITCH can return text, numbers, dates, or references. If no match is found, it can also return an optional default value.
=SWITCH(expression, value1, result1, [value2, result2], ..., [default])
The first argument is the expression Excel will compare. Each following pair contains a value to match and the result to return if it matches. Microsoft documents support for up to 126 value/result pairs, with an optional default as the final argument.
If no match is found and no default is supplied, SWITCH returns #N/A.
SWITCH and IFS can sometimes solve the same problem, but they approach it differently.
| Function | Best For | Strength | Typical Pattern |
|---|---|---|---|
SWITCH |
Exact matches | Clean mapping when one input should match known values | 1 - "Low", 2 - "Med", 3 - "High" |
IFS |
Ordered conditions and ranges | Better for thresholds like >=90 or <50 |
Grades, warning bands, eligibility tiers |
If your logic is based on exact known values, SWITCH is usually the more natural fit. If your logic is based on ranges or comparisons, IFS is often easier to read.
A simple SWITCH formula can replace a chain of repeated comparisons. For example, instead of checking the same cell again and again with IF, you can write the expression once and then list the outcomes. That keeps short mapping formulas tidy and easier to maintain.
It is also a good idea to include a default result whenever the input might contain unexpected values. A default such as "Unknown" or 0 helps prevent a raw #N/A result and gives the reader a clearer outcome.
You may also see the pattern SWITCH(TRUE,...). In that setup, the expression is the logical value TRUE, and each comparison is written as a condition such as B2>90. It works because Excel compares TRUE to the first condition that also evaluates to TRUE. This is a useful trick, though for many range-based formulas IFS may still read more naturally.
This is a straightforward exact-match example.
=SWITCH(B2,1,"Low",2,"Med",3,"High")
If B2 is 2, the result is "Med". This is a good fit for status codes, small category lists, and simple internal labels.
In cell F1, map B2 so 1 returns "Low", 2 returns "Med", and 3 returns "High".
A default keeps the formula from returning an unhelpful error when no match is found.
=SWITCH(B2,"A","Admin","U","User","Guest")
If B2 is "A", the result is "Admin". If it is "U", the result is "User". If it is something else, the formula returns "Guest".
In cell F2, map "A" to "Admin" and "U" to "User", and return "Guest" if there is no match.
This pattern turns SWITCH into an ordered logical test.
=SWITCH(TRUE,B2>10,"Big","Small")
If B2 is above 10, the comparison B2>10 evaluates to TRUE, so the formula returns "Big". Otherwise it falls through to the default result "Small".
In cell F3, use SWITCH(TRUE,...) so values above 10 return "Big" and everything else returns "Small".
SWITCH can also route between different cell values.
=SWITCH(B2,1,G2,2,H2,0)
If B2 is 1, the formula returns the value in G2. If B2 is 2, it returns H2. Otherwise it returns 0. This makes SWITCH useful for simple selection-based models.
In cell F4, return G2 when B2 is 1, H2 when B2 is 2, and 0 for anything else.
SWITCH compares one expression with a list of possible values.#N/A when nothing matches.SWITCH(TRUE,...) can handle ordered conditions.Tell your friends about this post