SWITCH comes in the category of logical functions. SWITCH function can be used for logical comparison of an expression to a list of values and to get the corresponding result. This can do multiple tests in a single run. Difference between SWITCH and IFS function is that SWITCH function evaluates only an exact match and does not use operators such as less than and greater than .SWITCH is also used in combination with other functions like AND , OR , COUNT etc.
=SWITCH(Expression, Value1, Result1, Value2,Result2,……)
- Expression- It is the expression with which a table of values will be compared.
- SWITCH calculates multiple tests in a single run.
- SWITCH function is case insensitive when we compare the text.
- If any of the arguments to SWITCH have been used as arrays, the SWITCH can measure each part of the array.
- SWITCH can run 12 condition in a single go.
- SWITCH function is only available is Excel 2016 and newer versions.
- Value1, Value2, ….- It is the table of values to which comparison is done.
- Result1, Result2, ….- It is the result which SWITCH returns when the corresponding value from table of values matches to the expression.
In the following example, SWITCH is used to return result based on the expression in column A and list of values provided to it. Then the results are written in the column C.