The if() formula in Notion lets you return different values based on a condition. It is the most common way to add logic to database properties. Many users struggle with nesting conditions or handling empty fields. This article explains the syntax, shows step-by-step examples, and covers common mistakes to avoid.
Key Takeaways: Using if() in Notion Formulas
- if(condition, value_if_true, value_if_false): Returns the second argument when the condition is true, otherwise the third argument.
- Nested if() functions: Replace the third argument with another if() to create multiple branches.
- Empty() and empty checks: Use
empty(prop("Field"))to test for blank properties before applying logic.
What the if() Formula Does and When to Use It
The if() formula evaluates a logical condition and returns one of two values. The condition can be any expression that results in true or false. Common conditions include comparing numbers, checking text, or testing whether a property is empty.
You can use if() in any Notion database formula property. No special permissions or settings are required. You only need a database with at least one property to use as input.
The syntax is: if(condition, value_if_true, value_if_false). The condition is always evaluated first. If it is true, the formula returns the second argument. If false, it returns the third argument.
The value_if_true and value_if_false can be any data type: text, number, date, or even another formula. This makes if() the building block for all conditional logic in Notion formulas.
Prerequisites
Before writing an if() formula, confirm you have:
- A Notion database (table or board view).
- At least one property with data to test, such as a Select, Number, or Text property.
- A Formula property added to the database. Add one by clicking the + in the last column header and selecting Formula.
Steps to Write a Basic if() Formula
- Open the formula editor
Click the Formula property header in your database. Select Edit property, then click inside the formula field. - Type the if() keyword
Enterif(. The editor will show a tooltip with the syntax. - Write the condition
Useprop("Property Name")to reference a property. For example,prop("Status") == "Done"checks if a Select property equals the text “Done”. - Add the true value
After the condition, type a comma, then the value to return when the condition is true. Example:"Complete". - Add the false value
Type another comma, then the value to return when the condition is false. Example:"In Progress". - Close the parentheses
Type)and click Done. The formula will evaluate for every row.
Example: if(prop("Status") == "Done", "Complete", "In Progress") returns “Complete” when the Status property is “Done” and “In Progress” for all other values.
Nested if() Formulas for Multiple Conditions
When you need more than two outcomes, nest one if() inside another. The inner if() replaces the false value of the outer if().
- Start with the first condition
Typeif(prop("Priority") == "High", "Urgent",. - Add the nested if()
Immediately after the comma, typeif(prop("Priority") == "Medium", "Normal", "Low"). - Close the outer if()
Add one closing parenthesis. The full formula:if(prop("Priority") == "High", "Urgent", if(prop("Priority") == "Medium", "Normal", "Low")).
You can nest up to several levels, but keep it readable by breaking complex logic into multiple formula properties if needed.
Checking for Empty Properties
A common use case is returning a default value when a property is empty. Use the empty() function inside the condition.
- Test for emptiness
Writeif(empty(prop("Due Date")), "No deadline", formatDate(prop("Due Date"), "MMM DD, YYYY")). - Why this matters
If you format an empty date property, the formula returns an error. Theempty()check prevents that error. - Apply to other types
Useempty(prop("Name"))for text orempty(prop("Cost"))for numbers.
Common Mistakes and How to Avoid Them
Missing Comma After the Condition
Forgetting a comma between the condition and the true value causes a syntax error. Always check that each argument is separated by a comma.
Using Wrong Comparison Operators
Notion uses == for equality, not =. For numbers, use >, <, >=, or <=. Text comparisons are case-sensitive.
Nesting Too Deeply
More than five nested if() functions become hard to read and debug. Consider using a separate formula property for each branch or using the ifs() function if available in your plan.
Not Handling Empty Fields
If a property used in the condition is empty, the formula may return an error or unexpected result. Always include an empty() check when the property is optional.
if() vs ifs() in Notion Formulas
| Item | if() | ifs() |
|---|---|---|
| Syntax | if(condition, true, false) | ifs(condition1, value1, condition2, value2, …) |
| Number of conditions | One per function, use nesting for more | Multiple pairs in a single function |
| Default fallback | Third argument is required | No default; returns an empty string if no condition matches |
| Readability | Harder with many conditions | Cleaner for three or more conditions |
| Availability | All plans | All plans |
The if() formula is the standard way to add conditional logic in Notion databases. You can now write simple conditions, nest multiple checks, and handle empty fields safely. Next, try combining if() with formatDate() or contains() to build dynamic labels. For advanced branching, use ifs() to reduce nesting and improve readability.