IF

An IF statement returns a value depending on whether the condition that is being evaluated is TRUE or FALSE.

Syntax

IF(logical_test, value_if_true, value_if_false)

Arguments

Return Value

Either value_if_true or value_if_false.

Remarks

  1. Returns Blank when the formula is misspelled.

  2. The specified node should contain Numerical data.

  3. The IF function returns error in any of the following cases:

  • value_if_false argument is missing.

  • The argument value_if_true or value_if_false are not of numeric data type.

  • Not using appropriate operator in logical_test.

Example

Consider the Revenue and Cost of Goods Sold nodes to follow the trend as shown below.

Now, a new node Gross Profit Margin can be computed using the IF function. Gross Profit Margin is calculated as (Revenue-Cost of Goods Sold)/Revenue. In case Revenue has period value of 0, Gross Profit Margin should return 0.

To achieve this, the following formula should be written in the [Gross Profit Margin] node:

IF([Revenue]==0,0%,([Revenue]-[Cost of Goods Sold])/[Revenue])

Result

As you can see from the above table, if the logical test condition (Revenue==0) is True, it returns 0, i.e. the gross profit margin is 0 and if the logical test condition is False (Revenue is a non-zero number), it calculates the Gross Profit Margin from the formula and returns it.

Use SWITCH function instead of nesting multiple IF functions.

Last updated