IF/THEN/ELSEstatements can be added to any valid calculation and used with the CALformat. Enter IF/THEN/ELSEcalculation formulas in the cell in the Related Formulas/Rows/Unitscolumn according to the following format:

IF <true/false statement> THEN <formula> ELSE <formula>

The ELSE <formula>portion of the statement is optional.

IF statements

The statement that follows the IFstatement can be any statement that can be evaluated as true or false. The statement that follows the IFstatement can appear as described below:

  • IF A.200>0(simple evaluation)

  • IF A.200>0 AND A.200<10,000(complex statement)

  • IF A.200>10000 OR ((A.340/B.1200)*2 <1200)(complex statement containing multiple expressions)

The term Periodsin an IFstatement is the number of periods for the report. This term is commonly used for calculating a year-to-date average. For example, when running a report for period 7 YTD, B.150/Periodsmeans to divide the value in row 150 of column B by 7.

THEN and ELSE formulas

The THENand ELSEformulas can be any valid calculation from the simplest value assignments to complex formulas. Note the following formula:

IF A.200>0 THEN A=B.200

The statement specifies that "if the value in the cell in column A of row 200 is greater than zero, then place the value from the cell in column B of row 200 into the cell in column A of the current row."

In this statement, you can also use the @ character in either TRUE/FALSEevaluations or in the formula to represent all columns. For example, the formula described in the preceding IF/THENstatement places a value in one column of the current row. Other examples are described below:

  • IF A.200 >0 THEN B.200: When the value in cell A.200 is positive, the value from cell B.200 is positioned into every column of the current row.

  • IF A.200 >0 THEN @200: When the value in cell A.200 is positive, the value from each column in row 200 is positioned into the corresponding column in the current row.

  • IF @200 >0 THEN @200: If the value in row 200 of the current column is positive, the value from row 200 is positioned into the same column in the current row.

See Also