Article updated on June 16, 2018

The SWITCH function returns a given value determined by an expression and a list of values. If the expression matches one of the values in the list the corresponding result value is returned. If no value matches an optional default value is returned by the function.

Formula in cell D3:

=SWITCH(C3,"A","Q1","B","Q2","C","Q3","D","Q4","No match")

Excel Function Syntax

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

Arguments

expression Required. This argument determines which value to be returned. If it matches the value argument the corresponding value in the result argument is returned.
value1 Required. If this value matches the expression the corresponding result argument is returned.
result1 Required. The value to be returned.
[value2] Optional. Up to 125 additional arguments.
[result2] Optional. Up to 125 additional arguments.
[default] Optional. This is the value to be returned if no other value matches, this must be the last argument in the function.

Comments

This feature is only available if you have an Office 365 subscription