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.

FunctionData Output TypeExampleOutput
ifAny Data Typeif(1 + 1 == 2, true, false)true
ifsAny Data Typeifs(1 + 1 == 3, false, 1 + 1 == 2, true)true
concatListconcat(["Luffy","Zoro"] ,["Nami","Chopper"])Luffy, Zoro, Nami, Chopper
joinStringjoin(["Luffy","Zoro","Nami","Chopper"], ", ")Luffy, Zoro, Nami, Chopper
sliceListslice(["Luffy", "Zoro", "Nami", "Chopper"], 1, 2)Zoro
lengthNumberlength("Monkey D. Luffy")15
formatStringformat(4)4 (as a string)
toNumberNumbertoNumber("42")42 (as a number)
containsBooleancontains("Monkey D. Luffy", "Luffy")true
replaceStringreplace("Pogo","Po","Dog")Doggo
replaceAllStringreplaceAll("Dogs Dogs Dogs","Dogs","Cats")Cats Cats Cats
testBooleantest("Monkey D. Luffy", "Luffy")true
emptyBooleanempty("")true
absNumberabs(-42)42
cbrtNumbercbrt(64)4
ceilNumberceil(4.2)5
expNumberexp(2)7.389056098931
floorNumberfloor(4.2)4
lnNumberln(20)2.995732273554
log10Numberlog10(1000)3
log2Numberlog2(64)6
maxNumbermax(3,5,4)5
minNumbermin(4,1,9,-3)-3
roundNumberround(4.5)5
signNumbersign(-5)-1
sqrtNumbersqrt(16)4
dateStartDatedateStart(prop("Date"))August 18, 2022
dateEndDatedateEnd(prop("Date"))August 25, 2022
nowDatenow()August 18, 2022 2:10 PM
timestampNumbertimestamp(now())1660853460000
fromTimestampDatefromTimestamp(1656012840000)June 23, 2022 1:34 PM
dateAddDatedateAdd(now(),3,"months")November 18, 2022 2:11 PM
dateSubtractDatedateSubtract(now(),3,"months")May 18, 2022 2:11 PM
dateBetweenNumberdateBetween(now(),prop("Date"),"days")9
formatDateStringformatDate(now(), "MMMM DD YYYY")August 18 2022
minuteNumberminute(now())9
hourNumberhour(now())14
dayNumberday(now())4
dateNumberdate(now())18
monthNumbermonth(now())7
yearNumberyear(now())2022
idStringid()c5d67d15854744869cc4a062fb7b1377
substringStringsubstring("Dangerfield", 0, 6)Danger
matchListmatch("Thomas 123 Frank 321", "\d+")123, 321
lowerStringlower("THOMAS FRANK")thomas frank
upperStringupper("Thomas Frank")THOMAS FRANK
repeatStringrepeat(“TF”, 5)TFTFTFTF
linkStringlink("Thomas Frank", "https://thomasjfrank.com")Thomas Frank
styleStringstyle("Thomas Frank", "b", "i",)Thomas Frank
unstyleStringunstyle("Thomas Frank", "i",)Thomas Frank
sumNumbersum(1, 2, 3)6
weekNumberweek(now())37
dateRangeDate RangedateRange(parseDate("2023"), parseDate("2023-02"))January 1, 2023 → February 1, 2023
parseDateDateparseDate("2023-01-01")January 1, 2023
nameStringprop("Created By").name()Thomas Frank
emailStringprop("Created By").email()[email protected]
atAny Data Typeat([1, 2, 3], 1)2
firstAny Data Typefirst([1, 2, 3])1
lastAny Data Typelast([1, 2, 3])3
sortListsort([2, 3, 1])1, 2, 3
reverseListreverse([1, 2, 3])3, 2, 1
splitListsplit(“One-Two-Three”, “-“)One, Two, Three
uniqueListunique([1, 1, 2])1, 2
includesBooleanincludes(["Luffy", "Zoro", "Nami", "Chopper"], "Zoro")true
findAny Data Typefind(["a", "b", "c"], currentValue == "b")b
findIndexNumberfindIndex(["a", "b", "c"], currentValue == "b")1
filterAny Data Typefilter([1, 2, 3], currentValue > 1)2, 3
someBooleansome([1, 2, 3], currentValue == 2)true
everyBooleanevery([1, 2, 3], currentValue > 0)true
mapAny Data Typemap([1, 2, 3], currentValue + 1)2, 3, 4
flatListflat([[1, 2], [3, 4]])1, 2, 3, 4
letAll Data Typeslet(a, 2, a + 2)4
letsAll Data Typeslets(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