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 you will get better performance by storing the list of values in a table and then use a query/join to retrieve the relevant items.

Examples

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 © 1999-2024 SS64.com
Some rights reserved