SWITCH

Switches values with new values if original value matches key

SWITCH( key, value1, returnValue1, [value2, returnValue2...] )

Returns the returnValue for any value that matches key

Arguments

Argument

Description

key

Key to find among key:value pairs

value1

Value(s) to check for key value match

returnValue1

Value to return if value1 is matched by key

[value2, returnValue2...]

Additional key:value pairs

Output

Outputs corresponding returnValue for value that matches key

Examples

SWITCH(2, 1, "Monday", 2, "Tuesday", 3, "Wednesday", 4, "Thursday")
>> "Tuesday"

Last updated