Documentation/Calc Functions/CHOOSE

Function name:
CHOOSE

Category:
Spreadsheet

Summary:
Accepts a list of up to 30 values, returning one of them. The value to return is selected using an additional index argument.

Syntax:
CHOOSE(Index; Value 1 [; Value 2 [; ... [; Value 30]]])

Returns:
Returns one of the supplied values, selected using the given index. The type of value returned depends on the type of the indexed argument.

Arguments:
Index is an integer in the range 1 ≤ Index ≤ 30, or a reference to a cell containing such an integer, that determines which value is to be selected from the list and returned. If Index is 1, the function returns the first value in the list; if Index is 2, it returns the second value in the list; and so on.

Value 1, Value 2, ..., Value 30 are values from which one is to be selected and returned. Each may be text, a number (real or integer), a date, a logical value, a reference, or a formula.


 * If Index is non-numeric, then CHOOSE reports a #VALUE! error.
 * If Index is a non-integer value, then CHOOSE truncates the value to an integer.
 * If, after truncation, Index is less than 1, or greater than the number of values supplied, then CHOOSE reports an invalid argument error (Err:502).
 * If more than 30 Value n arguments are supplied, then CHOOSE reports a parameter list error (Err:504).

Additional details:

 * Providing that separators are present, values can be omitted from within the list. CHOOSE returns 0 if such a missing value is indexed. For example, the formula  returns 0.


 * CHOOSE can be used in an array formula. For example, select cells A1 to A6 and enter the array formula  in the selected cells (using Ctrl+Shift+Enter rather than just Enter). Cell A1 assumes the value in D1, cell A2 assumes the value in D2, and so on.


 * Arguments other than the one chosen are not calculated or evaluated for side effects. For example, the formula  returns the value 2, but the formula   gives an an invalid argument error (Err:502) showing that the SQRT operation is only attempted when that argument is indexed.

Related LibreOffice functions:
IF

ODF standard:
Section 6.14.3, part 2

Equivalent Excel functions:
CHOOSE