The if()
operator allows you to write if-then statements within a Notion formula.
if([condition], ['then' expression], ['else' expression])
// Argument 1 must always return a Boolean value.
// Arguments 2 and 3 must have a matching type.
if(Boolean, string, string)
if(Boolean, number, number)
if(Boolean, Boolean, Boolean)
if(Boolean, date, date)
If-then statements, also called conditional statements, contain:
- The condition – a statement to be evaluated for truthiness (i.e. “is it true?”)
- The “then” statement – a statement that is executed if the condition is true
- The “else” statement – a statement that is executed if the condition is false
if()
looks like a function in Notion, but it’s actually considered an operator because an if-then statement can be written with ? and : instead of the if()
syntax.
Example Formulas
Simple String Comparison
This formula compares the output of a Select property called Type (which has a data type of String) with the string value “Mammal”. If the two are equal, it outputs true; otherwise, false.
if(prop("Type")=="Mammal",true,false)
Shorthand Syntax
If-then statements can also be written in a shorthand syntax. This uses ?
and :
as shorthand for if()
.
- Everything left of the
?
is the statement being evaluated. - Between
?
and:
is the output if the evaluated statement is true. - Right of the
:
is the output if the evaluated statement is false.
[condition] ? ['then' statement] : ['else' statement]
Here’s our example formula from above, re-written using shorthand:
prop("Type")=="Mammal" ? true : false
Taken together, ?
and :
form what’s called the conditional (or ternary) operator. It’s the only operator that takes in three operands, which are objects that are being operated on.
Most operators only work with two operands – for example:
-
2 + 5
– the add (+
) operator is working on2
and5
Check out the two formula properties in this example database; one uses the normal if-then syntax, while the other uses shorthand. You’ll see that their output is the same.

View and Duplicate Database

Other formula components used in this example:

Nested If-Then Statements
Writing nested if-statements can become difficult in Notion’s default formula editor. If you’re writing a long formula, I recommend writing it in a free code editor such as VS Code, and then minifying it using Excel Formula Beautifier so it can be pasted into Notion (remove the = sign at the beginning of the formula output if it exists before pasting).
Notion does not support the “else if” statement that is supported by more popular scripting and programming languages, such as Javascript.
With an else if statement, you could write code like this (in Javascript):
/* This is Javascript code that won't work in a Notion formula */
if (x<13) {
/* do one thing */
} else if (x<19) {
/* do another thing */
} else {
/* do the last thing */
}
In Notion, what we have to do instead is create nested if-then statements, like so:
if(
prop("Age") < 13,
"Child",
if(
prop("Age") < 19,
"Teenager",
"Adult"
)
)
- If the numeric value of a row’s Age property is less than 13, the then portion of the if-then statement is executed and the formula returns
Child
. - If not, the else statement is executed. In this case, our else statement is yet another if-then statement – hence, it’s a nested if-then statement.
Here’s the logic tree for this nested if-then statement:
https://whimsical.com/ApM11ByUEfRA77SKwUFhMG //whimsical embed
Here’s a compressed version you can paste into a Notion formula property:
// if() syntax
if( prop("Age") < 13, "Child", if( prop("Age") < 19, "Teenager", "Adult" ) )
// ? syntax
prop("Age") < 13 ? "Child" : prop("Age") < 19 ? "Teenager" : "Child"
// Notion will refrormat this to:
(prop("Age") < 13) ? "Child" : ((prop("Age") < 19) ? "Teenager" : "Child")
Good to know: As you can see in the code block above, you can create nested statements with the conditional operators ?
and :
as well.
When using these, you don’t even need to add your own parentheses ()
to create your nested statement; Notion will add them after you exit the formula editor.
In the example database below, you can see the nested if-statements at work:

View and Duplicate Database

Other formula components used in this example:
