CHOOSE
Returns one value from a list using a 1-based index.
CHOOSE selects from value1, value2, ... based on index_num.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=CHOOSE(index_num, value1, [value2], ...)
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
index_num | number | Required | — |
value1 | any | Required | — |
value2 | value | Optional | — |
Accepts a variable number of arguments. Minimum: 2.
Return type
Can return a reference when evaluated in a reference context.
Remarks
index_numis 1-based and is truncated to an integer.- Errors in
index_numare propagated. - The selected argument is returned as-is, including non-text/non-numeric values.
Error cases
- Indexes less than 1 or greater than the number of choices return
#VALUE!.
Examples
Select the second member of a list.
Formula =CHOOSE(2,"Low","Medium","High")
Expected result Medium
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Select a numeric value from a longer choice list.
Formula =CHOOSE(3,10,20,30)
Expected result 30
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Select the only item in the minimum-size list.
Formula =CHOOSE(1,"Only choice")
Expected result Only choice
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
An index beyond the last choice is invalid.
Formula =CHOOSE(4,"Low","Medium","High")
Expected result #VALUE!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Use numeric choices
Formula =CHOOSE(3,10,20,30,40)
Expected result 30
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
How are decimal index_num values handled?
The index is truncated toward zero before selection, so CHOOSE(2.9,...) selects the second argument.
What error do I get for index_num 0 or too large?
CHOOSE returns #VALUE! when index_num is less than 1 or greater than the number of provided choices.