# Operators

A reference list of all operators available for use in Notion formulas.
Operators are symbols that tell Notion's formula engine to perform specific operations.
Here's a very simple example:
1
2 + 2
This statement uses the add (`+`) operator to perform addition on two numbers. This formula will return a result of `4`.
The numbers on each side of the `+` operator are called operands. Operands are the discrete data objects that are either evaluated or manipulated by the operator.
In Notion formulas, operands have one of four data types - string, number, Boolean (checkbox), and date.
Operands can be hard-coded:
1
"Monkey D. Luffy will be " + "King of the Pirates!"
They can also pass data from another database property:
1
prop("First Name") + prop("Last Name")
You can also mix and match:
1
prop("First Name") + " " + prop("Last Name") + " will be King of the Pirates!"
Good to know: Notion's formula engine does not do automatic type conversion, so binary operators (operators with two operands) must have operands of the same data type.
E.g. `2 + "2"` will throw a Type Mismatch error because one operand is a number and the other is a string. You must convert one or the other so they are of the same type.
Notion's formula editor provides three types of operators:
1. 1.
Mathematical operators
2. 2.
Logical operators
3. 3.
Comparison operators
4. 4.
Special Operators

## Mathematical Operators

Mathematical operators allow you to do math on numbers.
Here are all the mathematical operators Notion provides. Note that Notion also provides a function version of each one, which I've listed in the reference table.
Operator
Symbol
Function Version
Example
`+`
`add()`
`2 + 2`
subtract
`-`
`subtract()`
`4 - 2`
multiply
`*`
`multiply()`
`5 * 5`
divide
`/`
`divide()`
`21 / 3`
pow
`^`
`pow()`
`2 ^ 3`
mod
`%`
`mod()`
`12 % 5`
`-`
`unaryMinus()`
`-4` (same as `-(4))`

## Logical Operators

Logical operators return a Boolean value, and often allow you to combine and evaluate multiple expressions.
Notion provides three logical operators.
Good to know: Notion is picky about how you must write logical operators. Only the listed symbols will work, and they are case-sensitive.
E.g. You must use `and` for the and operator - `And`, `AND`, and `&&` will not work in Notion.
Operator
Symbol
Function Version
Example
and
`and`
`and()`
`2 > 3 and 4 < 8`
or
`or`
`or()`
`2 > 1 or 6 > 5`
not
`not`
`not()`
`not empty("Hello")`

## Comparison Operators

Comparison operators allow you to compare operands that share a data type.
Notion provides six comparison operators:
Operator
Symbol
Function Version
Example
equal
`==`
`equal()`
`2 == 2`
unequal
`!=`
`unequal()`
`4 != 2`
larger
`>`
`larger()`
`5 > 3`
largerEq
`>=`
`largerEq()`
`4 >= 4`
smaller
`<`
`smaller()`
`6 < 9`
smallerEq
`<=`
`smallerEq()`
`9 <= 9`
Good to know: Comparison operators cannot be chained in formulas.
E.g. `1 < 2 < 3` will not work. Instead, use `1 < 2 and 2 < 3`.

## Special Operators

Notion also provides two special operators that don't fit neatly into the categories above.
The unaryPlus operator is the only operator that does type conversion; it converts strings and Booleans to numbers (use toNumber or timestamp if you need to convert a date to a number).
The if operator - also known as the ternary operator - lets you create if-then statements and branching logic in Notion formulas.
Operator
Symbol
Function Version
Example
unaryPlus
`+`
`unaryPlus()`
`+"3"` = `3`
if
`?` and `:`
`if()`
`2==2 ? true : false`

## Operator Precedence

Notion formulas can contain many operators, which can let you solve complex problems.
For example:
1
// Output: true
2
-((+"5")^2) < 20 - 10 ? true : false
When multiple operators are present in a Notion formula, their order of execution is determined by Notion's operator precedence rules: 