SWITCH
New Excel function in Excel 2016
The SWITCH function works in the same way as the existing IF function and the new IFS function. It is the same as multiple embedded IF functions .
Syntax
SWITCH(expression,value1,result1, [default or value2,result2],…)
The expression can be a value, cell reference or formula. It needs to be a single value rather than a range of values.
The expression is compared to each value in order. If an exact match is found, the matching result pair is returned. If no match is found, the default value is returned.
The value and result can be a value, cell reference or formula.
Comments
Best to use
- Simplify formulas using nested IF functions.
Limitations
The function can perform up to 126 comparisons.
Tip
If there are more than seven logical tests, consider creating a data table and using a VLOOKUP function instead.
Examples