SWITCH
The SWITCH Function switches values, by defining switch conditions and a default value if the switch conditions are not met. The amount of switch conditions is not limited.
Syntax
=SWITCH(LookupKey, KeyValue1, Value1, KeyValue2, Value2 ..., KeyValueN, ValueN, [DefaultValue])
Arguments
| Name | Type | Description |
|---|---|---|
| LookupKey | Value | Key to check |
| KeyValue1, Value1, KeyValue2, Value2 ..., KeyValueN, ValueN | Value | Key/Value pairs to find Key in. |
| DefaultValue (optional) | Value | Return value, if KeyValue is not found. |
Return
| Type | Description |
|---|---|
| Value | Default Value when switch condition is not met. ValueN, if LookupKey matched KeyValueN. |
Examples
| Formula | Result | Comment |
|---|---|---|
| "Mon" | The key 2 corresponds to the value "Mon". |
| "None" | The key 4 could not be found. |