CHOOSE

Microsoft Datasheet View

CHOOSE

Uses index_num to return a value from the list of value arguments. Use CHOOSE to select one of up to 29 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,...)

Index_num    specifies which value argument is selected. Index_num must be a number between 1 and 29, or a formula or column reference containing a number between 1 and 29.

  • 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,...    are 1 to 29 value arguments from which CHOOSE selects a value or an action to perform based on index_num. The arguments can be numbers, column references, formulas, functions, or text.

Remarks

Example 1

Col1Col2Col3Col4Formula Description (Result)
1st2nd3rdFinished=CHOOSE(2,[Col1],[Col2],[Col3],[Col4]) Value from the second argument Col2 (2nd)
NailsScrewsNutsBolts=CHOOSE(4,[Col1],[Col2],[Col3],[Col4]) Value from the fourth argument Col4 (Bolts)

Example 2

Col1Col2Col3Col4Formula Description (Result)
23451210=SUM([Col1], CHOOSE(2,[Col2],[Col3],[Col4])) Sums the two arguments Col1 and the result of the Choose function (35)