Skip to main content

IF function

  • December 21, 2021
  • 0 replies
  • 3881 views

Ben
Community Manager
Forum|alt.badge.img+8
  • Community Manager
  • 20 replies

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.

 

Example in a Complete Formula

Here are some examples of how to use IF with AND, OR, and NOT: 

  • AND : IF(Country = Country."France" AND Revenue > 1000, "Wow this is crazy good!")

  • OR:  IF(Country <> Country."France" OR Revenue < 1000, "Not so great!") 

  • NOT:  IF(NOT Country.'Has Sea Border', "No boats for you")

When using the NOT operator in formulas, keep in mind that NOT(blank) does not evaluate to TRUE—only NOT(FALSE) does. It's important to distinguish between blank and FALSE, as they can appear similar in cells with a Boolean data type.

 

See also

Excel: IF(logical_test, value_if_true, [value_if_false])

Related articles: SWITCH

Did this topic help you find an answer to your question?
This topic has been closed for comments

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings