The CHOOSE
function in Excel returns a value from a list of values based on a given index number. This function can be very handy when you want to select from a fixed list of options.
Syntax
excelCHOOSE(index_num, value1, [value2], ...)
index_num
: Specifies which value to return. It must be a number between 1 and 254.value1, value2, ...
: The list of values from which to choose. You can provide up to 254 values.
Example
Suppose you want to select a day of the week based on a number from 1 to 7.
- Basic Usage:
- Formula:
=CHOOSE(3, "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
- Result:
Tuesday
- Formula:
- Dynamic Index:
- If you want to dynamically choose a value based on a cell reference:
- Suppose cell A1 contains the number
5
. - Formula:
=CHOOSE(A1, "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
- Result:
Thursday
Practical Example
Imagine you have a table where you want to assign a grade based on a numeric score:
Enter the score in cell A1, for example,
2
.Use the
CHOOSE
function to return the corresponding grade:- Formula:
=CHOOSE(A1, "F", "D", "C", "B", "A")
- Result:
D
- Formula:
Step-by-Step Example
- In cell A1, enter the number
4
. - In cell B1, enter the following formula:excel
=CHOOSE(A1, "Red", "Green", "Blue", "Yellow", "Purple")
- The result in cell B1 will be
Yellow
, becauseYellow
is the fourth item in the list.
Example with a List of Months
If you want to use the CHOOSE
function to display a month name based on a number from 1 to 12:
- In cell A1, enter the number
7
. - In cell B1, enter the formula:excel
=CHOOSE(A1, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
- The result in cell B1 will be
July
.
These examples demonstrate how the CHOOSE
function can be used to return specific values based on an index number, allowing for flexible and dynamic content selection in your Excel sheets.
No comments:
Post a Comment