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 built-in functions you can use.
For example, the length function takes in a string argument and outputs a number equal 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 |
---|---|---|---|
concat | String | concat("Roronoa "," Zoro") |
Roronoa Zoro |
join | String | join(", ","Luffy ","Zoro","Nami","Chopper") |
Luffy, Zoro, Chopper |
slice | String | slice("Dangerfield",0,6) |
Danger |
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 |
start | Date | start(prop("Date")) |
August 18, 2022 |
end | Date | end(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 |
Functions as Arguments
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:
slice(format(1932),0,2)
// Output: 19
// Expanded form
slice(
format(1932),
0,
2
)
---
// Get the century name (e.g. "20th") from a year (expressed as a number)
concat(format(add(toNumber(slice(format(1932),0,2)),1)),"th")
// Output: 20th
// Expanded form
concat(
format(
add(
toNumber(
slice(
format(1932),
0,
2
)
),
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.