SWITCH function

Category: Logical
Introduced: Excel 2019

Summary

Evaluates an expression against a list of values and returns the result corresponding to the first matching value. If there is no match, an optional default value may be returned.

Syntax

SWITCH(expression, value1, result1, [default or value2, result2],…[default or value3, result3])

Example

=SWITCH(WEEKDAY(A2),1,"Sunday",2,"Monday",3,"Tuesday","No match")
=SWITCH(A3,1,"Sunday",2,"Monday",3,"Tuesday")
=SWITCH(A4,1,"Sunday",2,"Monday",3,"Tuesday","No match")
=SWITCH(A5,1,"Sunday",7,"Saturday","weekday")
=SWITCH(A6,1,"Sunday",2,"Monday",3,"Tuesday","No match")

Microsoft Support Page

https://support.microsoft.com/en-us/office/switch-function-47ab33c0-28ce-4530-8a45-d532ec4aa25e

Back to Functions