IF

Syntax

IF (Condition, Result if True, Result if False)

Description

The IF function returns Result if True if Condition is true; otherwise, the function returns Result if False.

Returns

Result if True if Condition is true; otherwise, the function returns Result if False.

Example

For example, suppose a company awards its salespeople a 10 percent commission on sales of at least USD 20000, and a 5 percent commission on sales under USD 20000. You create a COMMISSION cube and can compute the commission for each person as follows:

IF(SALES >= 20000, 0.1 * SALES, 0.05 * SALES)

The IF function in this formula tests whether SALES is greater than or equal to 20000. If so, the function returns 10 percent of SALES; otherwise, the function returns 5 percent of SALES.