Skip to main content

Description

Tests a Boolean argument and returns a value if the argument is True or another value if it is False or BLANK. Multiple IF functions can be nested to test multiple conditions at the same time.

 

Syntax

IF(Logical Test, Value if True , Value if False or BLANK])

 

Arguments

Argument Type Dimensions Description

Logical Test

(required)

Boolean Any Dimensions Boolean to test against that determines the values returned by the function.

Value if True

(required)

Any Any Dimensions The return value if the corresponding Logical Test value is True.

Value if False or BLANK

(optionnal)

Same as Value if True Any Dimensions The return value if the corresponding Logical Test value is False or BLANK.

 

Returns

Type Dimensions
Same Type as Value if True and Value if False or BLANK All Dimensions of the three arguments

 

It is recommended that the function is used with matching Dimensions as it makes it easier to read and understand. However, the function accepts any sets of Dimensions on its arguments and Pigment automatically allocates missing Dimensions on arguments to make them match. The resulting set of Dimensions is the combination of all Dimensions used in the arguments.

 

Examples

Formula Result Description
IF(TRUE, 1, 0) 1 The Logical Test is always True in this example so the result is expectedly 1.

IF(Revenue > 1000, “Large Account”, “SMB”)

“Large Account” if the given Revenue is greater than 1000.
“SMB” if the given Revenue is lesser or equal than 1000 or if the condition resolves as BLANK.
 
IF(Revenue > 1000, “Large Account”, IF(Revenue < 300, “Small Account”, “Medium Account”)) “Large Account” if the given Revenue is greater than 1000.
“Small Account” if the given Revenue is lesser than 300.
“Medium Account” if the given Revenue is between 300 and 1000 or if the condition resolves as BLANK.
Multiple nested IFs are used to test multiple conditions at the same time.

 

See also

Excel: IF(logical_test, value_if_true, avalue_if_false])

Related articles: SWITCH