CHOOSE
- CHOOSE(index, *values)[source]
Returns the value at a specified index from a list of inputs.
The CHOOSE function selects a value from the provided values based on the 1-based index. If the index is out of range, the formula will evaluate to an error. All input values must be of the same data type.
- Parameters:
- Return type:
- Returns:
A Formula object representing the selected value.
Supported types:
ANY
- Raises:
If no values are provided. - If the index is not an integer. - If the data types of the input values are inconsistent.
Examples
CHOOSE(2, "apple", "banana", "cherry") # Returns "banana"
CHOOSE(4, "apple", "banana", "cherry") # Returns an error value since index 4 is out of range.