WorksheetFunction.Choose (Excel)

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

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.

Choose (Arg1, Arg2, ..., Arg30)


Dim varChoose As Variant
varChoose = WorksheetFunction.Choose(Arg1:=, Arg2:=)

Arguments

Arg1, Arg2, ..., Arg30

Arg1 - 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