How do you use the CHOOSE function to select a value from a list of values?
Posted by SamPetr
Last Updated: July 28, 2024
The CHOOSE function in Excel is a versatile function that allows you to select a value from a pre-defined list based on an index number. The syntax for the CHOOSE function is:
CHOOSE(index_num, value1, [value2], ...)
Parameters:
- index_num: This is a required argument. It specifies which value to select from the list. It can be a number (e.g., 1, 2, 3...) or a reference to a cell that contains a number. - value1, value2, ...: These are the values from which you want to choose. You can specify up to 254 values.
Example:
Suppose you have a list of weekday names, and you want to select a weekday based on a user’s input: 1. In cell A1, you have the index number (e.g., 1 for Monday, 2 for Tuesday, etc.). 2. You want to select the weekday name based on the index in cell B1. You could use the following formula in cell B1:
=CHOOSE(A1, "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
What Happens:
- If A1 contains 1, B1 will display "Monday". - If A1 contains 3, B1 will display "Wednesday". - If A1 contains 7, B1 will display "Sunday".
Important Notes:
- The index_num should be within the range of the values provided (in this case, between 1 and 7). If it is outside this range, CHOOSE will return a #VALUE! error. - You can also use other expressions or cell references for the index_num argument, making the function dynamic based on other calculations or user inputs. This function is particularly useful for managing dynamic lists and selections without the need for complex nested statements or lookups.