CHOOSE function
The CHOOSE function in Excel is used to return a value from a list of options based on a given index number. It allows you to select one of many options depending on the index value provided.
Syntax:
=CHOOSE(index_num, value1, [value2], ...)
- index_num: The position (index) of the value to return. This is a numeric value or a reference to a cell containing a number. The index is used to select which value from the list of options to return.
- value1, value2, …: The list of values (or arguments) from which one will be chosen. You can provide up to 254 values.
Example 1: Basic Usage
If you want to choose a value from a list of fruits based on an index, for example:
=CHOOSE(2, "Apple", "Banana", "Cherry")
This will return "Banana", because the index number is 2, and “Banana” is the second item in the list.
Example 2: Using a Cell Reference for the Index
You can use a cell reference for the index_num. For example, if cell A1 contains the number 3:
=CHOOSE(A1, "Red", "Green", "Blue", "Yellow")
If A1 is 3, the result will be "Blue", because it’s the third value in the list.
Example 3: Returning a Numeric Value
The CHOOSE function can also return numeric values. For example:
=CHOOSE(1, 10, 20, 30)
This will return 10, as 10 is the first value in the list.
Example 4: Using the CHOOSE Function in a More Complex Formula
You can nest the CHOOSE function inside other functions or use it for more complex scenarios. For example:
=CHOOSE(MATCH(A1, {"Small", "Medium", "Large"}, 0), 10, 20, 30)
- Here,
MATCHis used to find the index of the value inA1within the array{"Small", "Medium", "Large"}. - Then,
CHOOSEuses that index to return10,20, or30based on the size.
Example 5: Handling Text Choices
You can use CHOOSE to handle text-based selections. For example:
=CHOOSE(1, "Low", "Medium", "High")
This will return "Low" because the index is 1.
Benefits:
- Simplicity: The
CHOOSEfunction allows you to pick a value from a list of options based on a numeric index, making it simpler than using multipleIFstatements orVLOOKUPin some cases. - Flexible Options: You can provide a wide variety of value types—numbers, text, dates, etc.—as the options for selection.
- Efficiency: It’s efficient when you need to return one of many values based on a specified index, and it works well with dynamic ranges or situations where you want to provide a list of possible results.
Limitations:
- Index Limit: The
index_numcan be any number from1to254, depending on the number of values provided. - No Matching: Unlike
VLOOKUPorINDEX/MATCH,CHOOSEdoes not search for values, it simply selects based on the given index number.
In summary, the CHOOSE function is a straightforward and versatile way to select a value from a list based on an index, making it useful in many cases where you want to return one option out of several.