Selects an expression from a list of expressions and returns its value.
Choose ( index, choice-1 [ , choice-2, … [ , choice-n ] ] )
Index - (Input, expression, Required)
Specifies the index of the expression to return. It must be within the range of 1 to the total number of expressions listed. If index is 1, the 1st expression is returned. If index is 2, the 2nd expression is returned, and so on. If a string value is passed, it will be converted first to an integer. If index is a floating-point value, it is rounded to the nearest integer. If index is less than 1 or greater than the total number of choices, then the result is Null. A non-numeric index also returns Null.
choice-1 - (Input, expression, At least one required)
Specifies one or more comma-delimited expressions. All of these expressions are evaluated, even though the results of only one of them is returned. This can become important if the expressions have unexpected side effects.
The value of the nth expression, indexed by the index
parameter.
Returns Null if no matching expression could be found. Also note
that Null could be returned if the selected expression evaluated
to Null.
Choose (1, 55, 66, 77) |
Returns 55 |
Choose (2, “aaa”, “bbb”, “ccc”) |
Returns “bbb” |
Choose (1.7, 55, 66, 77) |
Returns 55 |
Choose (“3”, 55, “bbb”, 77) |
Returns 77 |
Choose (0, 1, 2, 3) |
Returns |
Choose (4, 1, 2, 3) |
Returns Null |
Choose (Null, 1, 2, 3) |
Returns Null |
Choose (Error, 1, 2, 3) |
ReturnsNull |
Functions are specifically for use in the Macro Editor. Refer to Microsoft's official VB and JScript documentation for scripting equivalents.
Functions | Description function | Iff function | In function | Lookup function | Switch function | Value function
© 2004-2021 looksoftware. All rights reserved.