The IF function is used within conditional equation fields to generate a result based on a given condition. IF Statements refer to the IF(formula) statement entered within the equation editor.

IF Statements expect three arguments as input with each argument separated by a comma. As illustrated in the image below, the first argument is the condition, the second argument is the desired output if the condition is true, and the third argument is the desired output if the condition is false. Every IF statement should follow the same formatting as illustrated in the image below.

image-(3).png

For instance, say you have an Orders data table with a Total Cost field and you would like to create a new field with an updated total cost that adds a $5 shipping fee for every order with a total cost of less than or equal to $100. Meaning, if the total cost of the order is under or equal to $100, add a $5 shipping fee, otherwise keep the total cost as-is. You can accomplish this by creating a new equation field and within the Equation Editor, type "IF" followed by a left parentheses. Then enter the three arguments of (condition, true, false) as illustrated below:

if-equation.png

Let's breakdown the 3 arguments of this IF Statement with the following illustration:

image-(5).png

The following image displays the results of this conditional IF equation. As you can see, only Total Cost values under or equal to $100 have been calculated to a new value of plus +$5. Total Cost values above $100 remain the same.

if-equation-example.png