Articles with the tag:
Close
Changelog
Close
Articles with the tag:
Close
Try in the cloud
Try in the cloud

SWITCH Function

The SWITCH function is one of the logical functions. It is used to evaluate one value (called the 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], ...)

The SWITCH function has the following arguments:

Argument Description
expression The value that will be compared against value1 ...value126.
value1 ...value126 The value that will be compared against expression.
result1 ...result126 The result to be returned if the value1 ...value126 matches to the expression.
default The result to be returned if there are no matches. If the default argument is not specified and there are no matches, the function returns the #N/A error.

Notes

You can enter up to 254 arguments i.e. up to 126 pairs of values and results.

How to apply the SWITCH function.

Examples

The figure below displays the result returned by the SWITCH function.

SWITCH Function

Return to previous page
Try now for free Try and make your decision No need to install anything
to see all the features in action