Choose from a range in excel

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 Excel Starter 2010 More…Less

This article describes the formula syntax and usage of the CHOOSE function in Microsoft Excel.

Description

Uses index_num to return a value from the list of value arguments. Use CHOOSE to select one of up to 254 values based on the index number. For example, if value1 through value7 are the days of the week, CHOOSE returns one of the days when a number between 1 and 7 is used as index_num.

Syntax

CHOOSE(index_num, value1, [value2], …)

The CHOOSE function syntax has the following arguments:

  • Index_num    Required. Specifies which value argument is selected. Index_num must be a number between 1 and 254, or a formula or reference to a cell containing a number between 1 and 254.

    • If index_num is 1, CHOOSE returns value1; if it is 2, CHOOSE returns value2; and so on.

    • If index_num is less than 1 or greater than the number of the last value in the list, CHOOSE returns the #VALUE! error value.

    • If index_num is a fraction, it is truncated to the lowest integer before being used.

  • Value1, value2, …     Value 1 is required, subsequent values are optional. 1 to 254 value arguments from which CHOOSE selects a value or an action to perform based on index_num. The arguments can be numbers, cell references, defined names, formulas, functions, or text.

Remarks

  • If index_num is an array, every value is evaluated when CHOOSE is evaluated.

  • The value arguments to CHOOSE can be range references as well as single values.

    For example, the formula:

=SUM(CHOOSE(2,A1:A10,B1:B10,C1:C10))

evaluates to:

=SUM(B1:B10)

which then returns a value based on the values in the range B1:B10.

The CHOOSE function is evaluated first, returning the reference B1:B10. The SUM function is then evaluated using B1:B10, the result of the CHOOSE function, as its argument.

Examples

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

Data

1st

Nails

2nd

Screws

3rd

Nuts

Finished

Bolts

Formula

Description

Result

=CHOOSE(2,A2,A3,A4,A5)

Value of the second list argument (value of cell A3)

2nd

=CHOOSE(4,B2,B3,B4,B5)

Value of the fourth list argument (value of cell B5)

Bolts

=CHOOSE(3,»Wide»,115,»world»,8)

Value of the third list argument

world

Example 2

Data

23

45

12

10

Formula

Description (Result)

Result

=SUM(A2:CHOOSE(2,A3,A4,A5))

Sums the range A2:A4. The CHOOSE function returns A4 as the second part of the range for the SUM function.

80

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Purpose 

Get a value from a list based on position

Return value 

The value at the given position.

Usage notes 

The CHOOSE function returns a value from a list using a given position or index. The values provided to CHOOSE can be hard-coded constants or cell references. The first argument for the CHOOSE function is index_num. This is a number that refers to subsequent values by index or position. The next arguments, value1, value2, value3, etc. are the values from which to choose from. Choose can handle up to 254 values. However, CHOOSE will not retrieve an item from inside range or array constant provided as a value.  For larger sets of data in a table or range,  INDEX and MATCH is a better way to retrieve a value based on position.

Examples

The formulas below use CHOOSE to return the 2nd and 3rd values from a list:

CHOOSE(2,"red","blue","green") // returns "blue"
CHOOSE(3,"red","blue","green") // returns "green"

Above, «blue» is the second value, and «green» is the third value. In the example shown in the screenshot, the formula in cell C5 is:

CHOOSE(B5,"red","blue","green") // returns "red"

CHOOSE will not retrieve values from a range or array constant. For example, the formula below will return a #VALUE error:

=CHOOSE(2,A1:A3)  // returns #VALUE

This happens because the index number is out of range. In this case, the required syntax is:

=CHOOSE(2,A1,A2,A3)

To retrieve the nth item from a range, use INDEX and MATCH. CHOOSE can be used to provide a variable table to a function like VLOOKUP:

=VLOOKUP(value,CHOOSE(index_num,rng1,rng2),2,0) // variable table

Notes

  • If index_num is out of range, CHOOSE will return #VALUE
  • Values can also be references. For example, the address A1, or the ranges A1:10 or B2:B15 can be supplied as values.
  • CHOOSE will not retrieve values from a range or array constant.

Функция ВЫБОР позволяет выбрать одно значение из списка, до 254 значений. Например, один из дней, если значения — дни недели.

Описание функции ВЫБОР

Использует номер_индекса, чтобы выбрать и вернуть значение из списка аргументов-значений. Функция ВЫБОР позволяет выбрать одно значение из списка, в котором может быть до 254 значений. Например, если первые семь значений — это дни недели, то функция ВЫБОР возвращает один из дней при использовании числа от 1 до 7 в качестве аргумента «номер_индекса».

Синтаксис

=ВЫБОР(номер_индекса;значение1;[значение2];...)

Аргументы

Номер_индексаЗначение1Значение2, …

Обязательный аргумент. Номер выбираемого аргумента-значения. Номер индекса должен быть числом от 1 до 254, формулой или ссылкой на ячейку, содержащую число в диапазоне от 1 до 254.

  • Если номер_индекса равен 1, то функция ВЫБОР возвращает значение1; если он равен 2, возвращается значение2 и так далее.
  • Если номер_индекса меньше 1 или больше, чем номер последнего значения в списке, то функция ВЫБОР возвращает значение ошибки #ЗНАЧ!.
  • Если номер_индекса представляет собой дробь, то он усекается до меньшего целого.

Первый аргумент обязательный.. От 1 до 254 аргументов-значений, из которых функция ВЫБОР, используя номер индекса, выбирает значение или выполняемое действие. Аргументы могут быть числами, ссылками на ячейки, определенными именами, формулами, функциями или текстом.

Второй и последующие аргументы не обязательные.. От 1 до 254 аргументов-значений, из которых функция ВЫБОР, используя номер индекса, выбирает значение или выполняемое действие. Аргументы могут быть числами, ссылками на ячейки, определенными именами, формулами, функциями или текстом.

Замечания

  • Если номер_индекса является массивом, то при выполнении функции ВЫБОР вычисляется каждое значение.
  • Аргументы-значения функции ВЫБОР могут быть как ссылками на интервал, так и отдельными значениями.

​Например, формула:

=СУММ(ВЫБОР(2;A1:A10;B1:B10;C1:C10))

равна формуле:

=СУММ(B1:B10)

которая возвращает значение, вычисленное на основе значений в интервале ячеек B1:B10.

В этом примере сначала вычисляется функция ВЫБОР, которая возвращает ссылку на интервал B1:B10. Затем вычисляется функция СУММ, причем в качестве аргумента используется интервал B1:B10, то есть результат функции ВЫБОР.

Пример

Понравилась статья? Поделить с друзьями:
  • Choose and write the correct word look at
  • Choose and underline the right word it is
  • Choose and underline the correct word there was were
  • Choose and underline the correct word she
  • Choose and underline the correct word open your mouth and