Functions

Learn how to use functions within Notion formulas.

In programming, a function is a reusable bundle or “chunk” of code. Functions have names which, when called elsewhere in the program, execute the function’s code.

Functions can also take in outside data (these are called arguments), and return new data.

In Notion formulas, you cannot define your own functions. However, Notion has provided many functions you can use.

For example, the length function takes in a string argument and outputs a number equal to the number of characters in that string.

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

Here’s a list of every function available for use in a Notion formula. Click a function to learn more about how it works and see more examples.

Function Data Output Type Example Output
if Any Data Type if(1 + 1 == 2, true, false) true
ifs Any Data Type ifs(1 + 1 == 3, false, 1 + 1 == 2, true) true
concat List concat(["Luffy","Zoro"] ,["Nami","Chopper"]) Luffy, Zoro, Nami, Chopper
join String join(["Luffy","Zoro","Nami","Chopper"], ", ") Luffy, Zoro, Nami, Chopper
slice List slice(["Luffy", "Zoro", "Nami", "Chopper"], 1, 2) Zoro
length Number length("Monkey D. Luffy") 15
format String format(4) 4 (as a string)
toNumber Number toNumber("42") 42 (as a number)
contains Boolean contains("Monkey D. Luffy", "Luffy") true
replace String replace("Pogo","Po","Dog") Doggo
replaceAll String replaceAll("Dogs Dogs Dogs","Dogs","Cats") Cats Cats Cats
test Boolean test("Monkey D. Luffy", "Luffy") true
empty Boolean empty("") true
abs Number abs(-42) 42
cbrt Number cbrt(64) 4
ceil Number ceil(4.2) 5
exp Number exp(2) 7.389056098931
floor Number floor(4.2) 4
ln Number ln(20) 2.995732273554
log10 Number log10(1000) 3
log2 Number log2(64) 6
max Number max(3,5,4) 5
min Number min(4,1,9,-3) -3
round Number round(4.5) 5
sign Number sign(-5) -1
sqrt Number sqrt(16) 4
dateStart Date dateStart(prop("Date")) August 18, 2022
dateEnd Date dateEnd(prop("Date")) August 25, 2022
now Date now() August 18, 2022 2:10 PM
timestamp Number timestamp(now()) 1660853460000
fromTimestamp Date fromTimestamp(1656012840000) June 23, 2022 1:34 PM
dateAdd Date dateAdd(now(),3,"months") November 18, 2022 2:11 PM
dateSubtract Date dateSubtract(now(),3,"months") May 18, 2022 2:11 PM
dateBetween Number dateBetween(now(),prop("Date"),"days") 9
formatDate String formatDate(now(), "MMMM DD YYYY") August 18 2022
minute Number minute(now()) 9
hour Number hour(now()) 14
day Number day(now()) 4
date Number date(now()) 18
month Number month(now()) 7
year Number year(now()) 2022
id String id() c5d67d15854744869cc4a062fb7b1377
substring String substring("Dangerfield", 0, 6) Danger
match List match("Thomas 123 Frank 321", "\d+") 123, 321
lower String lower("THOMAS FRANK") thomas frank
upper String upper("Thomas Frank") THOMAS FRANK
repeat String repeat(“TF”, 5) TFTFTFTF
link String link("Thomas Frank", "https://thomasjfrank.com") Thomas Frank
style String style("Thomas Frank", "b", "i",) Thomas Frank
unstyle String unstyle("Thomas Frank", "i",) Thomas Frank
sum Number sum(1, 2, 3) 6
week Number week(now()) 37
dateRange Date Range dateRange(parseDate("2023"), parseDate("2023-02")) January 1, 2023 → February 1, 2023
parseDate Date parseDate("2023-01-01") January 1, 2023
name String prop("Created By").name() Thomas Frank
email String prop("Created By").email() [email protected]
at Any Data Type at([1, 2, 3], 1) 2
first Any Data Type first([1, 2, 3]) 1
last Any Data Type last([1, 2, 3]) 3
sort List sort([2, 3, 1]) 1, 2, 3
reverse List reverse([1, 2, 3]) 3, 2, 1
split List split(“One-Two-Three”, “-“) One, Two, Three
unique List unique([1, 1, 2]) 1, 2
includes Boolean includes(["Luffy", "Zoro", "Nami", "Chopper"], "Zoro") true
find Any Data Type find(["a", "b", "c"], currentValue == "b") b
findIndex Number findIndex(["a", "b", "c"], currentValue == "b") 1
filter Any Data Type filter([1, 2, 3], currentValue > 1) 2, 3
some Boolean some([1, 2, 3], currentValue == 2) true
every Boolean every([1, 2, 3], currentValue > 0) true
map Any Data Type map([1, 2, 3], currentValue + 1) 2, 3, 4
flat List flat([[1, 2], [3, 4]]) 1, 2, 3, 4
let All Data Types let(a, 2, a + 2) 4
lets All Data Types lets(a, 1, b, 2, a + b) 3

Functions can accept other functions as arguments, so long as the inner function outputs the data type that the outer function requires.

Here are a couple examples:

1932.substring(0, 2) /* Output: 19 */ --- /* Get the century name (e.g. "20th") from a year (expressed as a number) */ 1932.substring(0, 2).toNumber().add(1) + "th" /* Output: 20th */ /* Expanded form */ 1932 .substring(0, 2) .toNumber() .add(1) + "th"

For more examples, see the example databases for most of the functions. The majority in this reference use other functions as arguments in order to do useful things. To start, I’ll recommend checking out the format function’s example database.

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.

🤔 Have an UB Question?

Fill out the form below and I’ll answer as soon as I can! ~Thomas

🤔 Have a Question?

Fill out the form below and I’ll answer as soon as I can! ~Thomas