fbpx
Select Page

Returns the value following the first condition that is met.

Usage

If(<condition 1>, <value 1>, <condition 2>, <value 2>,…,<else>)

If Condition 1 is True, Value 1 is returned. If Condition 2 is True, Value 2 is returned. If all conditions are false, the Else value listed last in the function is applied.

condition 1 (required) Logical condition that returns a result that is either True or False. If the condition is True, the function returns the following value.

value 1 (required) The value to be returned if its preceding condition is True.

condition 2+, value 2+ (optional) Several <condition>, <value> pairs can be listed in a single function. Every supplied condition must have a corresponding value.

else (optional) The value to be returned if no conditionals evaluate as True. If no <else> condition is supplied, a Null result is returned when no conditions are met.

Examples

If([size] < 3, “small”, [size] < 6, “medium”, “large”)
  • Assign “small” to sizes less than 3, “medium” to sizes less than 6, and “large” to all other sizes.
If([revenue] – [cost] > 0, “profit”, “loss”)
  • Categorize a record as a profit or a loss based on revenue and cost.

See Also

SumIf
CountIf
Switch

More About Logical Functions

Logical functions test for True/False values. They evaluate a condition, and return a value based on whether the condition is True or False.

We are rewriting the rules of analytics. Sigma empowers domain experts to join the data conversation, answer the toughest questions, and drive insights.