The IF function (or SI in French) checks a condition and returns a value depending on whether it is true or false. It returns the type of the value provided (text, number...).
Syntax
IF(condition, value_if_true, value_if_false)
Parameters
Examples
Check an age condition
IF($age > 18, "Adult", "Minor")
The function checks whether the age is greater than 18: 1 function (IF()) that tests 1 condition (age > 18) and returns one of 2 values.
Expected result: if the age is greater than 18, the function returns "Adult". If the age is less than or equal to 18, it returns "Minor".
You can combine IF() with other functions like IS_EMPTY() to check both the presence of data and its value.
Practical use: check if stock is sufficient, calculate a discount based on the amount, check if an order has been shipped, determine the validity of a date, assign a category based on a score, verify if an invoice is paid, calculate shipping costs based on weight, assign a grade based on a threshold.
Go further
SWITCH
To test several cases at once, without stacking nested IF()s.
Or continue with
Formula glossary
All available operators and functions, sorted by category.