Use formulas to create or validate values
IF
This function allows you to make logical comparisons between a value and what you expect. This function returns one value if a preset condition is true, and another value if the condition is false.
Example
If([Stock Level] > 0,1,0)
Returns 'true' (1) when stock level is higher than 0
Returns 'false' (0) when stock level is not higher than 0
AND
You can combine multiple conditions in an if-statement by using the AND function. You can use the double '&&' symbol to do this:
Example
If ([Brand]='Lego' && [Stock Level] > 50, 'Top product', 'Regular product')
OR
Additionally, you can use two pipes '||' to define OR in an if-statement:
Example
If([Color]='red'|| [Color]= 'yellow' || [Color]= 'blue', 'Primary color', 'Other color')
Nested IF-statements
You can also use multiple if-statements to check for multiple comparisons.
Example
If([Brand]='Nike','Nike sneakers',if([Brand]='New Balance','New Balance sneakers','Other sneakers'))
IN
This function returns whether an element is in a set or not.
Example
IN([Brand],’Samsung’,’Nikon’,'Canon')
Returns true if Brand equals Samsung, Nikon or Canon
Returns false if not
Boolean
You can use booleans for making comparisons in an if-statement.
> |
Is greater than |
< |
Is smaller than |
>= |
Is greater than or equal to |
<= |
Is smaller than or equal to |
= |
Is equal to |
<> |
Is not equal to |