SpreadJS Documentation
SWITCH
SpreadJS Documentation > Formula Reference > Formula Functions > SWITCH

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

Syntax

SWITCH(expression,value, result, result_no_match)

Arguments

This function has the following arguments:

Argument Description
expression Value or expression to compare
value Value compared against expression
result Value returned if comparision matches
result_no_match Value returned if comparision do not match

Remarks

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

Data Types

Accepts data of any type. Returns data of any type.

Examples

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

See Also