This is a complete quick reference or “cheat sheet” for Notion formulas. On this page you’ll find one or more example formulas for every constant, operator, and function available in the Notion formula editor.

This cheat sheet is meant to be a quick, easy-to-use bookmark.

It is a companion to my complete Notion Formula Reference. There, you’ll find comprehensive technical documentation on Notion formulas, including:

You may also want to check out my Formula Examples Database in Notion itself; there, you’ll find more than 80 example databases demonstrating how to use every formula compononent listed here.

Here are some of the most common terms you’ll run across when working with Notion formulas. Each link here will take you to a full page in the Formula Reference where you can learn more.

• Property – other properties that exist in your Notion database.
• Constant – mathematical constants e and π, plus the Boolean values true and false.
• Operator – symbols that perform operations on 1-3 operands. Includes mathematical operators (such as add), Boolean operators (such as not), and the ternary operator (if).
• Function – pre-defined formulas that you can use to accomplish complex things quickly. Examples include concat (combines strings) and dateAdd (adds `x` units of time to a date).

Arguments are the accepted pieces of data used within functions:

```.wp-block-code {
border: 0;
}

.wp-block-code > div {
overflow: auto;
}

.shcb-language {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
-webkit-clip-path: inset(50%);
clip-path: inset(50%);
height: 1px;
margin: -1px;
overflow: hidden;
position: absolute;
width: 1px;
word-wrap: normal;
word-break: normal;
}

.hljs {
box-sizing: border-box;
}

.hljs.shcb-code-table {
display: table;
width: 100%;
}

.hljs.shcb-code-table > .shcb-loc {
color: inherit;
display: table-row;
width: 100%;
}

.hljs.shcb-code-table .shcb-loc > span {
display: table-cell;
}

.wp-block-code code.hljs:not(.shcb-wrap-lines) {
white-space: pre;
}

.wp-block-code code.hljs.shcb-wrap-lines {
white-space: pre-wrap;
}

.hljs.shcb-line-numbers {
border-spacing: 0;
counter-reset: line;
}

.hljs.shcb-line-numbers > .shcb-loc {
counter-increment: line;
}

.hljs.shcb-line-numbers .shcb-loc > span {
}

.hljs.shcb-line-numbers .shcb-loc::before {
border-right: 1px solid #ddd;
content: counter(line);
display: table-cell;
text-align: right;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
width: 1%;
}
```// function_name(argument_1, argument_2)

divide(10,2) // Output: 5

// Note that spaces between arguments are optional, but
// commas are required.
concat("My", " ", "Chemical", " ","Romance")
// Output: My Chemical Romance
``````

Notion formulas support four distinct data types:

• String – text content
• Number – numeric characters, on which mathematical operations can be performed
• Boolean/Checkbox – true/false values
• Date – date objects

Good to know: A Notion formula can only return data of a single type. When working with multiple data types, make sure to use type conversion to convert everything to a single type in order to avoid errors.

Full reference: e

``````e
// Output: 2.718281828459

500 * e ^ (.3 * 10)
// Output: 10042.768461593832

``````

Full reference: pi

``````pi
// Output: 3.14159265359

pi * 10^2
// Output: 314.159265358979

``````

Full reference: true

``````true
// Output: true (checked checkbox)

true ? "😀" : "😭"
// Output: 😀

``````

Full reference: false

``````false
// Output: false (unchecked checkbox)

false ? "😀" : "😭"
// Output: 😭

``````

Full reference: if

``````// if() syntax
if(prop("Type")=="Mammal",true,false)
// Output: true

// ternary syntax
prop("Type")=="Mammal" ? true : false
// Output: true

// Nested if statement
if(
prop("Age") < 13,
"Child",
if(
prop("Age") < 19,
"Teenager",
)
)

``````

`+` or `add()`

``````2 + 5
// Output: 7

"Monkey D." + " Luffy"
// Output: Monkey D. Luffy

// Output: 11

// Output: Monkey D. Luffy

``````

Full reference: substract

`-` or `subtract()`

``````12 - 5
// Output: 7

subtract(5,12)
// Output: -7

``````

Full reference: multiply

`*` or `multiply()`

``````12 * 4 // Output: 48

multiply(12,-4) // Output: -48

``````

Full reference: divide

`/` or `divide()`

``````12 / 4 // Output: 3

divide(12,-4) // Output: -3

``````

Full reference: pow

`^` or `pow()`

``````3 ^ 4 // Output: 81

pow(4,3) // Output: 64

2 ^ 2 ^ 3 // Output: 256 - evaluates as 2 ^ (2 ^ 3)

``````

Full reference: mod

`%` or `mod()`

``````19 % 12 // Output: 7

19 mod 12 // Output: 7

mod(-19,12) // Output: -7

``````

Full reference: unaryMinus

`-` or `unaryMinus()`

``````-42 // Output: -42

-(-42) // Output: 42

unaryMinus(42) // Output: -42

``````

Full reference: unaryPlus

`+` or `unaryPlus()`

``````+"42" // Output: 42

+true // Output: 1

+false // Output: 0

unaryPlus("42") // Output: 42

20 + + "30" // Output: 50

-+"30" // Output: -30

20 + - + "30" // Output? -10 [Notion will rewrite this to 20 + -(+"30")]

``````

Full reference: not

``````not true // Output: false

not(true) // Output: false

not empty("Hello") // Output: true

not if(50>40,true,false) // Output: false

``````

Full reference: and

``````true and true // Output: true

true and false // Output: false

and(1>0,0<4) // Output: true

if(true and true, "Happy", "Sad") // Output: "Happy"

if(5>4 and 1<3, true, false) // Output: true

if(length("Monkey D. Luffy") > 5 and length("Monkey D. Luffy") < 100, true, false) // Output: true

4>2 and 3<4 and 7==7 ? true : false // Output: true

``````

Full reference: or

``````true or false // Output: true

false or true // Output: true

false or false // Output: false

10 > 20 or "Cat" == "Cat" // Output: true

10 > 20 or "Cat" == "Dog" or true // Output: true

``````

Full reference: equal

``````1 == 1 // Output: True

equal(1,1) // Output: True

1 == 2 // Output: False

"1" == 1 // Type mismatch error

+"1" == 1 // Output: True (uses the unaryPlus operator to convert "1" to a number

2^2 == 4 // Output: True

length("Monkey D. Luffy") == 15 // Output: True

``````

Full reference: unequal

``````1 != 2 // Output: True

1 != 1 // Output: False

unequal("Cat","Dog") // Output: True

"1" != 2 // Type mismatch error

2^3 != 10 // Output: True

``````

Full reference: larger

``````2 > 1 // Output: true

42 > 50 // Output: false

// Boolean values equate to 1 (true) and 0 (false).
true > false // Output: true

true > true // Output: false

// For dates, "less than" equates to "before".
now() > dateSubtract(now(), 1, "days") // Output: true

``````

Full reference: largerEq

``````2 >= 1 // Output: true

42 >= 42 // Output: true

// Boolean values equate to 1 (true) and 0 (false).
true >= false // Output: true

true >= true // Output: true

// For dates, "less than" equates to "before".
now() >= now() // Output: true

``````

Full reference: smaller

``````2 < 1 // Output: false

42 < 50 // Output: true

// Boolean values equate to 1 (true) and 0 (false).
false < true // Output: true

true < true // Output: false

// For dates, "less than" equates to "before".
now() < dateAdd(now(), 1, "months") // Output: true

``````

Full reference: smallerEq

``````2 <= 3 // Output: true

42 <= 42 // Output: true

// Boolean values equate to 1 (true) and 0 (false).
false <= true // Output: true

true <= true // Output: true

// For dates, "less than" equates to "before".
now() <= now() // Output: true

``````

Full reference: concat

``````concat("Roronoa ","Zoro") // Output: Roronoa Zoro

"Roronoa " + "Zoro" // Output: Roronoa Zoro

concat("Chopper") // Output: Chopper (this is pointless, but it works)

concat("Monkey", " D.", "Luffy", " will ", "be", " King of the Pirates")
// Output: Monkey D. Luffy will be King of the Pirates

// use "\\n" to create line breaks
concat("Luffy \\n", "Zoro \\n", "Sanji \\n", "Nami \\n")
// Output:
// Luffy
// Zoro
// Sanji
// Nami

``````

Full reference: join

``````join(", ","Luffy","Zoro","Nami","Chopper")
// Output: Luffy, Zoro, Nami, Chopper

// Use "\\n" to add line breaks
join("\\n","Luffy","Zoro","Nami","Chopper")
// Output:
// Luffy
// Zoro
// Nami
// Chopper

``````

Full reference: slice

``````slice("Dangerfield",0,6) // Output: Danger

slice("Monkey D. Luffy",0,6) // Output: Monkey

slice("Monkey D. Luffy", 10, 15) // Ouput: Luffy

slice("●●●●●●●●●●",0,6) + slice("○○○○○○○○○○",0,6) // Output: ●●●●●○○○○○

``````

Full reference: length

``````length("Monkey D. Luffy") // Output: 15

length("Supercalifragilisticexpialidocious") // Output: 34

length("Doctor Doom") // Output: 11

``````

Full reference: format

``````format(4) // Output: 4 (as a string)

format(5+5) // Output: 10 (as a string)

format(true) // Output: true (as a string)

format(5>4) // Output: true (as a string)

format(now()) // Output: June 20, 2022 2:23 PM (changes with now()'s value)

"There are " + format(10) + " Straw Hat members."
// Output: There are 10 Straw Hat members.

``````

Full reference: toNumber

``````toNumber("42") // Output: 42 (number)

toNumber(true) // Output: 1

toNumber(false) // Output: 0

toNumber(5>3) // Output: 1

toNumber(now()) // Output: 1655757000000 (changes with now()'s value)

``````

Full reference: contains

``````contains("Monkey D. Luffy", "Luffy") // Output: true

contains("Monkey D. Luffy", "keyLuf") // Output: false

// Invalid
contains(true, "true") // Error: Type mismatch true is not a Text.

``````

For `replace()`, `replaceAll()`, and `test()`, you may also want to refer to my full guide on using regular expressions in Notion.

Full reference: replace

``````replace("Pogo","Po","Dog") // Output: Doggo

// Matches the first occurrance, unless otherwise specified
replace("Dogs Dogs Dogs","Dogs","Cats") // Output: Cats Dogs Dogs

// \$ tells the regex engine "start from end of line and work backwards"
replace("Dogs Dogs Dogs","Dogs\$","Cats") // Output: Dogs Dogs Cats

// Matches are case-sensitive
replace("thomas","t","T") // Output: Thomas

// You can use brackets [] to create a set of characters,
// any of which will be matched
replaceAll("thomas", "[Tt]homas", "Megatron") // Output: Megatron

// You can also create a group with () and then use the | (OR) operator
replaceAll("thomas", "(T|t)homas", "Megatron") // Megatron

// Accepts regex metacharacters, such as "\\\\b" which denotes "word boundary".
// Without \\\\b, this would output "Thwas is Sparta"
replace("This is Sparta","\\\\bis\\\\b","was") // Output: This was Sparta

``````

Full reference: replaceAll

``````replaceAll("Dogs Dogs Dogs","Dogs","Cats") // Output: Cats Cats Cats

// Matches are case-sensitive
replaceAll("Dogs dogs Dogs","Dogs","Cats") // Output: Cats dogs Cats

// You can use brackets [] to create a set of characters,
// any of which will be matched
replaceAll("Dogs dogs Dogs", "[Dd]ogs", "Cats") // Output: Cats Cats Cats

// You can also create a group with () and then use the | (OR) operator
replaceAll("Dogs dogs Dogs", "(D|d)ogs", "Cats") // Cats Cats Cats

// Accepts regex metacharacters, such as "\\\\b" which denotes "word boundary".
// Without \\\\b, this would output "Thwas was Sparta"
replaceAll("This is Sparta","\\\\bis\\\\b","was") // Output: This was Sparta

// replaceAll() is a great way to count elements in a string.
// Do this by using a regular expression to remove all characters
// except the commas that separate the elements (see the example
// database below for an in-depth look at this)
replaceAll("Dog, Cat, Monkey, Bat, Gorilla","[^,]","") // Output: ,,,,
// Apply length() + 1 to get the count!

``````

Full reference: test

``````test("Monkey D. Luffy", "Luffy") // Output: true

// test() is case-sensitive
test("Monkey D. Luffy", "luffy") // Output: false

// You can use brackets [] to create a set of characters,
// any of which will be matched
test("Monkey D. luffy", "[Ll]uffy") // Output: true

// You can also create a group with () and then use the | (OR) operator
test("Monkey D. luffy", "(L|l)uffy") // Output: true

``````

Full reference: empty

``````empty("") // Output: true

empty(0) // Output: true

empty(false) // Output: true

// Assume a row where the Name property is currently blank
empty(prop("Name")) // Output: true

// Assume a row where the Name property contains text
not empty(prop("Name")) // Output: true

// The same result can be accomplished with conditional operators
// (Assume the Name property contains text in this row)
empty(prop("Name")) ? false : true // Output: true

``````

Full reference: abs

``````abs(-42) // Output: 42

abs(42) // Output: 42

``````

Full reference: cbrt

``````cbrt(8) // Output: 2

cbrt(64) // Output: 4

// Total surface area of cube with Volume 300m³
// using formula 6a², where a = edge length
6 * cbrt(300)^2 // Output: 268.88428479343

``````

Full reference: ceil

``````ceil(4.2) // Output: 5

ceil(3.845) // Output: 4

ceil(4) // Output: 4

// Calculate the donated change in a round-up donation
// Assume prop("Subtotal") is \$5.34
ceil(prop("Subtotal")) - prop("Subtotal")
// Output: \$0.66

``````

Full reference: exp

``````exp(2) // Output: 7.389056098931

exp(5) // Output: 148.413159102577
e^5 // Output: 148.413159102577

exp(ln(5)) // Output: 5
ln(exp(5)) // Output 5

``````

Full reference: floor

``````floor(4.2) // Output: 4

floor(3.845) // Output: 3

floor(4) // Output: 4

``````

Full reference: ln

``````ln(20) // Output: 2.995732273554

ln(e) // Output: 1

``````

Full reference: log10

``````log10(1000) // Output: 3

log10(10) // Output: 1

``````

Full reference: log2

``````log2(64) // Output: 6

log2(2) // Output: 1

``````

Full reference: max

``````max(3,5,4) // Output: 5

// Assume prop("Num") contains 20
max(prop("Num"),13,5) // Output: 20

// Other data types must be converted to number
max(1,+true,+"3",9) // Output: 9
// Here, the + operator (unaryPlus) is used to convert
//  true and "3" to numbers.

``````

Full reference: min

``````min(4,1,9,-3) // Output: -3

// Assume prop("Num") contains 3
max(prop("Num"),13,5) // Output: 3

// Other data types must be converted to number
min(3,8,+false) // Output: 0
// Here, the + operator (unaryPlus) is used to convert
// false to a number (0)

``````

Full reference: round

``````round(4.5) // Output: 5

round(4.49) // Output: 4

round(-4.49) // Output: -4

round(-4.5) // Output: -4

round(-4.51) // Output: -5

``````

Full reference: sign

``````sign(-5) // -1

sign(5) // 1

sign(0) // 0

sign(+"-1") // -1

``````

Full reference: sqrt

``````sqrt(16) // Output: 4

sqrt(100) // Output: 10

sqrt(73-3^2) // Output: 8

``````

Full reference: start

``````// Assume a property "Date" exists, with
// a row value of June 23, 2022 → June 27, 2022
start(prop("Date")) // Outpuut: June 23, 2022

``````

Full reference: end

``````// Assume a property "Date" exists, with
// a row value of June 23, 2022 → June 27, 2022
end(prop("Date")) // Outpuut: June 27, 2022

``````

Full reference: now

``````now() // Output: June 23, 2022 12:30 PM (at time of writing)

``````

Full reference: timestamp

``````timestamp(now()) // Output: 1656012120000 (will change with the value of now()

``````

Full reference: fromTimestamp

``````// Notion will express this date in your local time zone, so it
// may look different if you try this formula out.hin
fromTimestamp(1656012840000) // Output: June 23, 2022 7:34 PM (UTC)

``````

``````// Assume a property called "Date" with a current row value
// of June 1, 2022
dateAdd(prop("Date"),3,"months") // Output: September 1, 2022

dateAdd(prop("Date"),5,"days") // Output: June 6, 2022

``````

Full reference: dateSubtract

``````// Assume a property called "Date" with a current row value
// of June 1, 2022
dateSubtract(prop("Date"),3,"months") // Output: March 1, 2022

dateSubtract(prop("Date"),5,"days") // Output: May 27, 2022

``````

Full reference: dateBetween

``````// Assume now() == June 23, 2022 and Date == June 1, 2022
dateBetween(now(),prop("Date"),"days") // Output: 22

// Assume now() == June 23, 2022 and Date == June 30, 2022
dateBetween(now(),prop("Date"),"days") // Output: -6

// Assume now() == June 23, 2022 and Date == December 25, 2022
dateBetween(now(),prop("Date"),"months") // Output: -6

``````

Full reference: formatDate

``````formatDate(now(), "MMMM DD YYYY") // Output: June 24 2022

formatDate(now(), "dddd, MMMM DD, YYYY hh:mm A zz")
// Output: Friday, June 24, 2022 10:45 AM MDT

formatDate(now(), "[Month of] MMMM, YYYY") // Output: Month of June, 2022

``````

Good to know: `formatDate()` uses Moment.js for date formatting.

Full reference: minute

``````minute(now()) // Output: 25 (When current time was 11:25 AM)

// Assume a propety called Date with a current date of June 24, 2022 11:29 AM
minute(prop("Date")) // Output: 29

``````

Full reference: hour

``````hour(now()) // Output: 11 (When current time was 11:25 AM)

// Assume a propety called Date with a current date of June 24, 2022 11:29 AM
hour(prop("Date")) // Output: 11

``````

Full reference: day

``````day(now()) // Output: 5 (when now() = June 24, 2022)

// Assume a propety called Date with a current date of June 1, 2022
day(prop("Date")) // Output: 3

``````

Full reference: date

``````date(now()) // Output: 24 (when now() = June 24, 2022)

// Assume a propety called Date with a current date of June 1, 2022 11:29 AM
date(prop("Date")) // Output: 1

``````

Full reference: month

``````month(now()) // Output: 5 (when now() = June 24, 2022)

// Assume a propety called Date with a current date of Jan 1, 2022
month(prop("Date")) // Output: 0

``````

Full reference: year

``````year(now()) // Output: 2022 (When now() = June 24, 2022)

// Assume a propety called Date with a current date of June 24, 2022
year(prop("Date")) // Output: 2022

``````

Full reference: id

``````// Page URL: <https://www.notion.so/thomasfrank/id-c5d67d15854744869cc4a062fb7b1377>
id() // Output: c5d67d15854744869cc4a062fb7b1377

``````

Here a few useful tips for working more effectively with formulas:

Full reference: Writing Complex Formulas in VS Code

You can write formulas in a text editor like VS Code; this will allow you to use indentation, multiple lines, and comments.

When you need to compress your formula for pasting into Notion, simply do a search-and-replace.

Search for the following regular expression:

``````(\n[ ]{2,}|\n|[/]{2}[^\n]*)
``````
1. Copy and paste your formula. We’ll compress one of the copies, leaving the other as an easy-to-read reference.
2. Open the find and replace window with `Ctrl/⌘ + F` and paste the expression into the find field.
3. Paste in the expression above.
4. Click the Use Regular Expression button.
5. Select the entirety of your formula (just one of the copies)
6. Click the Find in Selection button.
7. Ensure the Replace field is blank.
8. Click the Replace All button.

Full reference: Return Null/Empty Values in Formulas

To return an empty string:

``````""
``````

To return an empty number:

``````toNumber("")
``````

To return an empty date:

``````fromTimestamp(toNumber(""))
``````

There is no possible null/empty state for Booleans/Checkboxes. However, you can convert Booleans to strings with format in order to create a setup where true/false/empty is possible:

``````// Assume "Checkbox" is a Boolean/Checkbox property.

// Invalid; will throw a Type Mismatch error:
if( 1 > 2, prop("Checkbox"), "")

// Valid. Will output "true", "false", or an empty value.
if( 1 > 2, format(prop("Checkbox")), "")
``````

If you find this cheat sheet useful, you’ll also love my Notion Tips newsletter! Join to get notified whenever I publish new tutorials, guides, and templates: