# Function "Choose" (index;LIST of values)

I have an age related variable: costs vary by three age groups - €1361 (0-13yrs); €680 (14-20yrs); €272 (21+yrs). Can I use the function "choose"? Does anyone how to use this function? I have read the function help, but could not figure out how to add "index":-(

Your help would be greatly appreciated!

Bing

• Official comment

I will highlight how the Choose function using the example below.

Choose( index; 100; 200; 300)

We will assume there is some formula that provides the value for "index". This formula must provide back a value of 1, 2 or 3, or the Choose function will fail.

• index 1 - Choose returns 100
• index 2 - Choose returns 200
• index 3 - Choose returns 300

I don't think the Choose function on its own will be the best approach for your issue.

However, a table will work nicely.

Table name: AgeCost

Table lookup method: Truncate

Table data:

• Index, Value
• 0, 1361
• 14, 680
• 21, 272

Your expression would then be AgeCost[age], which I would place in a formula variable.

With the lookup method of truncate, the expression will return...

• 1361 for ages 0-13
• 680 for ages 14-20
• 272 for ages 21 and above

I hope this is helfpul.

Andrew

• I am glad this worked for you.

Andrew