Expand Minimize

WorksheetFunction.Choose Method (Excel)

Uses Arg1 as the index to return a value from the list of value arguments.

expression .Choose(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name

Required/Optional

Data Type

Description

Arg1

Required

Variant

Specifies which value argument is selected. Arg1 must be a number between 1 and 29, or a formula or reference to a cell containing a number between 1 and 29.

Arg2 - Arg30

Required

Variant

1 to 29 value arguments from which Choose selects a value or an action to perform based on Arg1. The arguments can be numbers, cell references, defined names, formulas, functions, or text.

Return Value

Variant

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

  • If Arg1 is less than 1 or greater than the number of the last value in the list, Choose generates an error.

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

  • If Arg1 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.

Show:
© 2014 Microsoft