Choose

Function that returns a value from a list of values based on a given position.

Syntax
      Choose ( index, value1, value2, ... value_n )

value1, value2, ... value_n is a list of values.

index is the position number in the list of values to return, so Choose(2, "The", "universe", "is", "expanding") will return "universe" the second item in the list.

In many cases it can be less work to store the list of values in a table and then use a query/join to retrieve the relevant items.

Example

Dim varDemo as String

varDemo = choose(4,"The", "universe", "is", "expanding")

“I chose and my world was shaken. So what? The choice may have been mistaken; the choosing was not. You have to move on” ~ Stephen Sondheim

Related:

CBool - Convert to boolean
CByte
- Convert to byte
CCur
- Convert to currency (number)
CDate
- Convert to Date
CDec - Convert to Decimal (number)
CInt - Convert to Integer (number)
CLng
- Convert to Long (number)
DAvg function (VBA) - Average
Number Data Types
Convert to Base 36
Nz function -


© Copyright SS64.com 1999-2013
Some rights reserved