Links

Operator Precedence and Associativity

Learn about operator precedence and associativity in Notion formulas.
Notion operators have a specific operator precedence order. Operators with a higher precedence (11 being the highest) will have their logic executed before operators of lower precedence.
Operators at the same precedence level are executed either left-to-right or right-to-left, depending on their associativity.
Refer to the table below to see the precedence level and associativity of each operator.
Precedence
Operator Name
Associativity
Symbol
11
Parentheses
N/A
()
10
Not
right-to-left
not
9
Exponentiation (pow)
right-to-left
^
8
unaryPlus, unaryMinus
right-to-left
+, -
7
multiply, divide
left-to-right
*, /
6
add, subtract
left-to-right
+, -
5
larger, largerEq, smaller, smallerEq
N/A
>, >=, <, <=
4
unequal, equal
N/A
!=, ==
3
And
left-to-right
and
2
Or
left-to-right
or
1
Conditional (if)
right-to-left
... ? ... : ...
Since parentheses () have the highest precedence in a Notion formula, you can use them to define a specific order of operations within any formula.
It's also good to understand that associativity can be thought of as an implied default setting of parentheses. For example:
1
// Multiply has left-to-right associativity. The following are equivalent:
2
2 * 3 * 4 // Output: 24
3
(2 * 3) * 4 // Output: 24
4
5
// Exponentiation has right-to-left associativity (the "Tower Rule"). The following are equivalent:
6
2 ^ 3 ^ 2 // Output: 512
7
2 ^ (3 ^ 2) // Output: 512
Certain operators cannot be chained in Notion formulas; thus, they do not have associativity. These are marked with "N/A" in the associativity column.
For example, the following formulas will not work in Notion:
1
// Invalid
2
1 > prop("Number") > 5
3
4
// Valid
5
1 > prop("Number") and prop("Number") < 5 // Output: True
6
7
---
8
9
// Invalid
10
1 == +true == +"1"
11
12
// Valid
13
1 == +true and 1 == +"1" // Output: True
If you want to understand operator precedence and associativity more thoroughly, I'll recommend reading through the Operator Precedence guide for JavaScript on MDN's web docs:
Operator Precedence/Associativity Proofs

About the Author

My name is Thomas Frank, and I'm a Notion-certified writer, YouTuber, and template creator. I've been using Notion since 2018 to organize my personal life and to run my business and YouTube channel. In addition to this formula reference, I've created a free Notion course for beginners and several productivity-focused Notion templates. If you'd like to connect, follow me on Twitter.