Documentation/Calc Functions/SWITCH

From The Document Foundation Wiki
Jump to: navigation, search


Im-jabber.svg

Under construction.
For now, see the system Help files.


Function name:

SWITCH

Category:

Logical

Summary:

SWITCH compares expression with value1 to valuen and returns the result belonging to the first value that equals expression. If there is no match and default_result is given, that will be returned.

Syntax:

SWITCH( expression, value1, result1[, value2, result2][, … ][, default_result] )

Returns:

Arguments:

expression is a text, numeric, logical or date input or reference to a cell.

value1, value2, ... is any value or reference to a cell. Each value must have a result given.

result1, result2, ... is any value or reference to a cell.

default_result: any value or reference to a cell that is returned when there is no match.

If no value equals expression and no default result is given, a #N/A error is returned.

Additional details:

Examples:

=SWITCH(MONTH(A3),1,"January",2,"February",3,"March","No match") returns "January" when A3 contains a date in January, "February" when A3 contains a date in February , etc...

Related LibreOffice functions:

IF
IFS

ODF standard:

Equivalent Excel functions: