The CHOOSE
function in Excel is used to select a value from a list of values based on an index number. The syntax is:
=CHOOSE(index_num, value1, [value2], ...)
index_num
: The position of the value you want to return (1-based index).value1, value2, ...
: The list of values or formulas from which to choose.
Here are 10 examples of how to use the CHOOSE
function, including data and formulas:
Example 1: Basic Usage
Select a value from a list of options.
A | B | Formula | Result |
---|---|---|---|
1 | 2 | =CHOOSE(A1, "Apple", "Banana", "Cherry") | Banana |
Example 2: Using Cell References
Select a value based on a cell reference.
A | B | Formula | Result |
---|---|---|---|
1 | 3 | =CHOOSE(B1, "Red", "Green", "Blue") | Blue |
Example 3: Combining with Other Functions
Use CHOOSE
with SUM
to select a range to sum.
A | B | C | D | Formula | Result |
---|---|---|---|---|---|
1 | 10 | 20 | 30 | =SUM(CHOOSE(2, A1:B1, B1:C1, C1:D1)) | 50 (Sums B1:C1 ) |
Example 4: Nested CHOOSE
Use CHOOSE
inside another CHOOSE
.
A | B | Formula | Result |
---|---|---|---|
1 | 2 | =CHOOSE(A1, CHOOSE(B1, "X", "Y"), "Z") | Y |
Example 5: Dynamic Formulas
Use CHOOSE
to select a formula dynamically.
A | B | C | D | Formula | Result |
---|---|---|---|---|---|
1 | 10 | 20 | 2 | =CHOOSE(D1, A1+B1, A1*B1) | 200 (A1*B1) |
Example 6: Text Concatenation
Use CHOOSE
to concatenate text.
A | B | Formula | Result |
---|---|---|---|
1 | 2 | =CHOOSE(A1, "Hello, ", "Hi, ") & "John" | Hello, John |
Example 7: Date Selection
Use CHOOSE
to select a date.
A | B | Formula | Result |
---|---|---|---|
1 | 3 | =CHOOSE(A1, DATE(2023,1,1), DATE(2023,2,1), DATE(2023,3,1)) | 3/1/2023 |
Example 8: Logical Operations
Use CHOOSE
with logical conditions.
A | B | Formula | Result |
---|---|---|---|
1 | 2 | =CHOOSE((A1>1)+1, "False", "True") | True |
Example 9: Lookup Alternative
Use CHOOSE
as a simple lookup.
A | B | Formula | Result |
---|---|---|---|
1 | 3 | =CHOOSE(A1, "Low", "Medium", "High") | High |
Example 10: Error Handling
Use CHOOSE
to handle errors.
A | B | Formula | Result |
---|---|---|---|
1 | 4 | =IFERROR(CHOOSE(A1, 10, 20, 30), "Invalid Index") | Invalid Index |
Key Notes:
The
index_num
must be between 1 and the number of values provided.If
index_num
is out of range, Excel returns an error (#VALUE!
).You can use up to 254 values in the
CHOOSE
function.
No comments:
Post a Comment