[]
        
(Showing Draft Content)

SWITCH

This function compares specified expression against given list of values and returns the result according to the first matching value.

Syntax

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

Arguments

This function has the following arguments:

Argument

Description

expression

[Required] Expression is the value (such as a number, date or some text) that will be compared against value1…value126.

value1…value126

ValueN is a value that will be compared against expression.

result1…result126

ResultN is the value to be returned when the corresponding valueN argument matches expression. ResultN must be supplied for each corresponding valueN argument.

default

[Optional] Default is the value to return in case no matches are found in the valueN expressions. The Default argument is identified by having no corresponding resultN expression (see examples). Default must be the final argument in the function.

Remarks

In this function, argument value and result can take up to 126 different entries each.

Examples

SWITCH(WEEKDAY(A2),1,"Sunday",2,"Monday",3,"Tuesday","No match") gives the result No match.