How to use the CHOOSE function in Excel
How to use the CHOOSE function in Excel: The CHOOSE function in Excel is used to search for a value within a range of values. This function is commonly used for calculations and data lookup in Excel, often in combination with other Excel functions like the SUM function. Using the CHOOSE function can simplify calculations. The following article will guide you on how to use the CHOOSE function in Excel.
1. CHOOSE function syntax
Function syntax: =CHOOSE(index_num, value1, [value2], …)
- index_num: Required argument, the position of the value to return. index_num must be a number from 1 to 254 or a formula or reference to a cell containing a number from 1 to 254.
- value1, value2, …: value1 is required, and subsequent values are optional. These value arguments from 1 to 254 from which CHOOSE selects a value or action to perform based on index_num. The arguments can be numbers, cell references, defined names, formulas, functions, or text.
- If index_num is 1, the function returns value1; if it is 2, the function returns value2; and so on.
- If index_num is less than 1 or greater than the number of the last value in the list, the function returns the #VALUE! error value.
- If index_num is not an integer, the function returns the #VALUE! error value.
- If index_num is a fraction, it is truncated to the nearest lower integer before being used.
- If index_num is an array, all values are evaluated when the CHOOSE function is evaluated.
- The value arguments for the CHOOSE function can be a range reference as well as individual values.
2. How to use the CHOOSE function
For example, suppose we have the following data table:
If we want to retrieve the code of the third item, we can use the formula: =CHOOSE(3, B2, B3, B4, B5, B6, B7, B8, B9, B10)
Or =CHOOSE(A4, B2, B3, B4, B5, B6, B7, B8, B9, B10)
Alternatively, we can directly input the item code in the function like this:
=CHOOSE(3, 0002, 0005, 0011, 0013, 0014, 1001, 1002, 9003, 9004)
We can also combine the CHOOSE function with the SUM function to calculate the total revenue, for example:
=SUM(D2:CHOOSE(8, D3, D4, D5, D6, D7, D8, D9, D10))
Therefore, the above article has guided you on how to use the CHOOSE function and how to combine it with the SUM function in Excel. Good luck!