Properties
A function is a set of statements that performs a task or calculates a value. They allow you to manipulate different types of data in Notion, from text and numbers to lists and pages.
Returns the first value if the condition is true; otherwise, returns the second value.
Syntax
if(condition, ifTrue, ifFalse)
condition.if(ifTrue, ifFalse)
if(
1 + 1 == 3,
"1 plus 1 equals 3!",
"1 plus 1 does not equal 3!"
)if(
/* Check if 1 plus 1 equals 3 */
1 + 1 == 3,
/* If it does, display "1 plus 1 equals 3!" */
"1 plus 1 equals 3!",
/* Otherwise display "1 plus 1 does not equal 3!" */
"1 plus 1 does not equal 3!"
)
=
1 plus 1 does not equal 3!
"1 plus 1 does not equal 3!"
Learn more about if →
Returns the value that corresponds to the first true condition.
Syntax
ifs(condition, ifTrue, condition2, ifTrue2, ..., else)
condition.ifs(ifTrue, condition2, ifTrue2, ..., else)
ifs(
1 + 1 == 1, "1 plus 1 equals 1.",
1 + 1 == 3, "1 plus 1 equals 3.",
"1 plus 1 equals 2."
)ifs(
/* Check if 1 + 1 equals 1, and if it does display "1 plus 1 equals 1." */
1 + 1 == 1, "1 plus 1 equals 1.",
/* Otherwise check if 1 + 1 equals 2, and if it does display "1 plus 1 equals 3." */
1 + 1 == 2, "1 plus 1 equals 3.",
/* Otherwise display "1 plus 1 equals 2." */
"1 plus 1 equals 2."
)
=
1 plus 1 equals 2.
"1 plus 1 equals 2."
Learn more about ifs →
The boolean operator and.
Syntax
and(boolean, boolean, ...)
boolean.and(boolean, ...)
and(
1 + 2 == 3,
3 + 4 == 7,
5 + 6 == 11
)and(
/* Check if 1 plus 2 equals 3 */
1 + 2 == 3,
/* Then check if 3 plus 4 equals 7 */
3 + 4 == 7,
/* Then check if 5 plus 6 equals 11 */
5 + 6 == 11
/* If all of the above are true, return a checked box */
)
Learn more about and →
The boolean operator or.
Syntax
or(boolean, boolean, ...)
boolean.or(boolean, ...)
Learn more about or →
Returns the opposite of a boolean value.
Syntax
not(boolean)
boolean.not()
Learn more about not →
Returns true if the value is empty.
Syntax
empty(value)
value.empty()
Learn more about empty →
Returns the length of the text or list value.
Syntax
length(value)
value.length()
Learn more about length →
Returns the substring of the text from the start index (inclusive) to the end index (optional and exclusive).
Syntax
substring(text, startIndex, endIndex?)
text.substring(startIndex, endIndex?)
Learn more about substring →
Returns true if the search string is present in the value.
Syntax
contains(value, search)
value.contains(search)
Learn more about contains →
Returns true if the value matches the regular expression and false otherwise.
Syntax
test(text, pattern)
text.test(pattern)
Learn more about test →
Returns all matches of the regular expression as a list.
Syntax
match(text, pattern)
text.match(pattern)
Learn more about match →
Replaces the first match of the regular expression with the replacement value.
Syntax
replace(text, pattern, replacement?)
text.replace(pattern, replacement?)
Learn more about replace →
Replaces all matches of the regular expression with the replacement value.
Syntax
replaceAll(text, pattern, replacement?)
text.replaceAll(pattern, replacement?)
Learn more about replaceAll →
Converts the text to lowercase.
Syntax
lower(text)
text.lower()
Learn more about lower →
Converts the text to uppercase.
Syntax
upper(text)
text.upper()
Learn more about upper →
Removes whitespace from the beginning and end of the text.
Syntax
trim(text)
text.trim()
Learn more about trim →
Repeats the text a given number of times.
Syntax
repeat(text, count)
text.repeat(count)
Learn more about repeat →
Returns the text padded with the provided padding string at the start until the target length is reached.
Syntax
padStart(text, targetLength, padString)
text.padStart(targetLength, padString)
Learn more about padStart →
Returns the text padded with the provided padding string at the end until the target length is reached.
Syntax
padEnd(text, targetLength, padString)
text.padEnd(targetLength, padString)
Learn more about padEnd →
Creates a hyperlink from the label text and the URL.
Syntax
link(text, url)
text.link(url)
Learn more about link →
Adds styles and colours to text.
Syntax
style(value, styles)
value.style(styles)
Learn more about style →
Removes formatting styles from the text. If no styles are specified, all styles are removed.
Syntax
unstyle(value, styles?)
value.unstyle(styles?)
Learn more about unstyle →
Returns the value formatted as text.
Syntax
format(value)
value.format()
Learn more about format →
Returns the number value formatted as text.
Syntax
formatNumber(value, format?, precision?)
value.formatNumber(format?, precision?)
Learn more about formatNumber →
Returns the sum of two numbers.
Syntax
add(number, number)
number.add(number)
Learn more about add →
Returns the difference of two numbers.
Syntax
subtract(number, number)
number.subtract(number)
Learn more about subtract →
Returns the product of two numbers.
Syntax
multiply(number, number)
number.multiply(number)
Learn more about multiply →
Returns the first number modulo the second number.
Syntax
mod(number, number)
number.mod(number)
Learn more about mod →
Returns the result of a base number raised to an exponent power.
Syntax
pow(number, number)
number.pow(number)
Learn more about pow →
Returns the quotient of two numbers.
Syntax
divide(number, number)
number.divide(number)
Learn more about divide →
Returns the smallest number of the arguments.
Syntax
min(list)
list.min()
Learn more about min →
Returns the largest number of the arguments.
Syntax
max(list)
list.max()
Learn more about max →
Returns the sum of its arguments.
Syntax
sum(list)
list.sum()
Learn more about sum →
Returns the middle value of its arguments.
Syntax
median(list)
list.median()
Learn more about median →
Returns the arithmetic average of its arguments.
Syntax
mean(list)
list.mean()
Learn more about mean →
Returns the absolute value of the number.
Syntax
abs(number)
number.abs()
Learn more about abs →
Returns the value of a number rounded to the nearest integer.
Syntax
round(number)
number.round()
Learn more about round →
Returns the smallest integer greater than or equal to the number.
Syntax
ceil(number)
number.ceil()
Learn more about ceil →
Returns the largest integer less than or equal to the number.
Syntax
floor(number)
number.floor()
Learn more about floor →
Returns the positive square root of the number.
Syntax
sqrt(number)
number.sqrt()
Learn more about sqrt →
Returns the cube root of the number.
Syntax
cbrt(number)
number.cbrt()
Learn more about cbrt →
Returns e^x, where x is the argument, and e is Euler's number (2.718…), the base of the natural logarithm.
Syntax
exp(number)
number.exp()
Learn more about exp →
Returns the natural logarithm of the number.
Syntax
ln(number)
number.ln()
Learn more about ln →
Returns the base 10 logarithm of the number.
Syntax
log10(number)
number.log10()
Learn more about log10 →
Returns the base 2 logarithm of the number.
Syntax
log2(number)
number.log2()
Learn more about log2 →
Returns 1 if the number is positive, -1 if it is negative, and 0 if it is zero.
Syntax
sign(number)
number.sign()
Learn more about sign →
Returns the ratio of a circle's circumference to its diameter.
Learn more about pi →
Returns the base of the natural logarithm.
Learn more about e →
Parses a number from text.
Syntax
toNumber(value)
value.toNumber()
Learn more about toNumber →
Returns the current date and time.
Learn more about now →
Returns the current date without the time.
Learn more about today →
Returns the minute of the date (0-59).
Syntax
minute(date)
date.minute()
Learn more about minute →
Returns the hour of the date (0-23).
Syntax
hour(date)
date.hour()
Learn more about hour →
Returns the day of the week of the date, between 1 (Monday) and 7 (Sunday).
Syntax
day(date)
date.day()
Learn more about day →
Returns the day of the month from the date (1-31).
Syntax
date(date)
date.date()
Learn more about date →
Returns the ISO week of the year of the date (1-53).
Syntax
week(date)
date.week()
Learn more about week →
Returns the month of the date (1-12).
Syntax
month(date)
date.month()
Learn more about month →
Returns the year of the date.
Syntax
year(date)
date.year()
Learn more about year →
Adds time to the date. The unit argument can be one of: "years", "quarters", "months", "weeks", "days", "hours", or "minutes".
Syntax
dateAdd(date, num, unit)
date.dateAdd(num, unit)
Learn more about dateAdd →
Subtracts time from the date. The unit argument can be one of: "years", "quarters", "months", "weeks", "days", "hours", or "minutes".
Syntax
dateSubtract(date, num, unit)
date.dateSubtract(num, unit)
Learn more about dateSubtract →
Returns the difference between two dates. The unit argument can be one of: "years", "quarters", "months", "weeks", "days", "hours", or "minutes".
Syntax
dateBetween(date, date, unit)
date.dateBetween(date, unit)
Learn more about dateBetween →
Returns a date range constructed from the start and end dates.
Syntax
dateRange(start, end)
start.dateRange(end)
Learn more about dateRange →
Returns the start of the date range.
Syntax
dateStart(dateRange)
dateRange.dateStart()
Learn more about dateStart →
Returns the end of the date range.
Syntax
dateEnd(dateRange)
dateRange.dateEnd()
Learn more about dateEnd →
Returns the current Unix timestamp, representing the number of milliseconds that have elapsed since January 1, 1970.
Syntax
timestamp(date)
date.timestamp()
Learn more about timestamp →
Returns the date from the given Unix timestamp.
Syntax
fromTimestamp(timestamp)
timestamp.fromTimestamp()
Learn more about fromTimestamp →
Formats the date using a custom format string.
Syntax
formatDate(date, format)
date.formatDate(format)
Learn more about formatDate →
An incredibly powerful addition, this function will convert an ISO 8601 string into a date object.
Syntax
parseDate(dateText)
dateText.parseDate()
Learn more about parseDate →
Returns the name of a person.
Syntax
name(person)
person.name()
Learn more about name →
Returns the email address of a person.
Syntax
email(person)
person.email()
Learn more about email →
Returns the value at the specified index in a list.
Syntax
at(list, index)
list.at(index)
Learn more about at →
Returns the first item in the list.
Syntax
first(list)
list.first()
Learn more about first →
Returns the last item in the list.
Syntax
last(list)
list.last()
Learn more about last →
Returns the items of the list from the provided start index (inclusive) to the end index (optional and exclusive).
Syntax
slice(list, startIndex, endIndex?)
list.slice(startIndex, endIndex?)
Learn more about slice →
Returns the concatenation of multiple lists.
Syntax
concat(list, list2, ...)
list.concat(list2, ...)
Learn more about concat →
Returns the list in sorted order. Optionally, a provided expression can be used to determine the sorting order.
Syntax
sort(list, expression?)
list.sort(expression?)
Learn more about sort →
Returns the reversed list.
Syntax
reverse(list)
list.reverse()
Learn more about reverse →
Returns the values of the list with the joiner placed between each of the values.
Syntax
join(list, joiner)
list.join(joiner)
Learn more about join →
Returns a list of values created by splitting a string by a separator.
Syntax
split(text, separator)
text.split(separator)
Learn more about split →
Removes a specified number of elements from a list at the startIndex and optionally inserts new elements at that position. If deleteCount is not provided, it defaults to 0.
Syntax
splice(list, startIndex, deleteCount?, ...)
list.splice(startIndex, deleteCount?, ...)
Learn more about splice →
Returns the list of unique values in the input list.
Syntax
unique(list)
list.unique()
Learn more about unique →
Returns true if the list contains the specified value, and false otherwise.
Syntax
includes(list, search)
list.includes(search)
Learn more about includes →
Returns the first element in the list for which the condition returns true.
Syntax
find(list, condition)
list.find(condition)
Learn more about find →
Returns the index of the first item in the list for which the condition evaluates to true.
Syntax
findIndex(list, condition)
list.findIndex(condition)
Learn more about findIndex →
Returns the values in the list for which the condition is true.
Syntax
filter(list, condition)
list.filter(condition)
Learn more about filter →
Returns true if any item in the list satisfies the given condition, and false otherwise.
Syntax
some(list, expression)
list.some(expression)
Learn more about some →
Returns true if every item in the list satisfies the given condition, and false otherwise.
Syntax
every(list, condition)
list.every(condition)
Learn more about every →
Returns the list populated with the results of calling the expression on every item in the input list.
Syntax
map(list, expression)
list.map(expression)
Learn more about map →
Flattens a list of lists into a single list.
Syntax
flat(list, list2?, ...)
list.flat(list2?, ...)
Learn more about flat →
Returns the id of the page. If no page is provided, returns the id of the page the formula is on.
Syntax
id(value?)
value?.id()
Learn more about id →
Returns true if both values are equal and false otherwise.
Syntax
equal(value, value)
value.equal(value)
Learn more about equal →
Returns false if both values are equal and true otherwise.
Syntax
unequal(value, value)
value.unequal(value)
Learn more about unequal →
Assigns a value to a variable and evaluates the expression using that variable.
Syntax
let(variable, value, expression)
variable.let(value, expression)
Learn more about let →
Assigns values to multiple variables and evaluates the expression using those variables.
Syntax
lets(variable, value, variable2, value2, ..., expression)
variable.lets(value, variable2, value2, ..., expression)
Learn more about lets →
Returns the number of elements in a list for which the condition is true. If no condition is provided, returns the total number of elements (equivalent to length()).
Syntax
count(list, condition)
list.count(condition)
Learn more about count →