Documentation/Calc Functions/CHOOSE

From The Document Foundation Wiki
Jump to navigation Jump to search


Function name:

CHOOSE

Category:

Spreadsheet

Summary:

Uses an index to return a value from a list of up to 30 values.

Syntax:

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

Returns:

Returns a value (alpha-numeric and symbols) based on the Index from Value1, Value2, ..., Value30.

Arguments:

Index is a whole number ranging from 1 to 30 (both inclusive) or a reference to the cell containing that number indicating which value is to be taken from the list.

Value1, Value2, ..., Value30 is a list of values (alpha-numeric and symbols) entered as a reference to a range of cells or as individual values in an array.

  • If Index is not an integer value then it is truncated to an integer.
  • If after truncation, Index is not a whole number ranging from 1 to 30 (both inclusive) or doesn't have a corresponding value for the index then the function returns an error value.

Additional details:

None

Examples:

Formula Description Returns
=CHOOSE(A1;B1;B2;B3;"Today";"Yesterday";"Tomorrow") where A1 contains 4 The function returns 4th value. "Today"
=CHOOSE(A1;B1;B2;B3;"Today";"Yesterday";"Tomorrow") where A1 contains 2 and B2 contains 5i63$ The function returns 2nd value 5i63$
=CHOOSE(A1;B1;B2;B3;"Today";"Yesterday";"Tomorrow") where A1 contains 10 The function returns an error value since 10th indexed value doesn't exit Err:502

Related LibreOffice functions:

IF

ODF standard:

Section 6.14.3, part 2

Equivalent Excel functions:

CHOOSE