You are here: Features > Cell Functions > Condition Functions > CHOOSE function

CHOOSE Function

The CHOOSE function returns one of several values based on the numeric value of an expression. If the expression equals 1, it returns the first value. If the expression equals 2, it returns the second value. If the expression returns a value not supplied, the function returns Null.

Syntax

CHOOSE(expression,value1,<value2,...>)

Example 1

CHOOSE(c3,"First","Second","Third")

If c3 is equal to 1, the cell displays First. If c3 is equal to 2, the cell displays Second, and if c3 is equal to 3, the cell displays Third. If c3 contains a value other than 1, 2, or 3, the cell will be blank.

Example 2

CHOOSE(CLP22,CLP63,CLP65,CLP67,CLP69,CLP71,CLP73,CLP75,CLP77,CLP79,CLP81,CLP83,CLP85)

The above example will consider the value of CLP22, which is the Engagement Properties code representing the current active period. If the current active period is 1 the cell displays CLP63, the CLP equivalent of the ending date of period 1. If it is equal to 2, it displays CLP65, the CLP equivalent to the ending date of period 2. If it is 3, it will display the ending date of period 3, and so on.

Similarly,

CHOOSE(CLP22,CLP62,CLP64,CLP66,CLP68,CLP70,CLP72,CLP74,CLP76,CLP78,CLP80,CLP82,CLP84)

Will return the beginning date of the current active period.

Notes

  • It is also possible to use PERTOJ function to return the Julian date of a specified period.

Related Topics