Links

length

Learn how to use the length function in Notion formulas.
The length() function outputs a number that corresponds to the length of a string.
1
length(string)

Example Formulas

1
length("Monkey D. Luffy") // Output: 15
2
​
3
length("Supercalifragilisticexpialidocious") // Output: 34
4
​
5
length("Doctor Doom") // Output: 11

Example Database

This example database used the length() function to return the number of characters in the Name property. It also uses an if statement to intelligently output “character” or “characters”.

View and Duplicate Database

“Characters” Property Formula

1
// Compressed
2
format(length(prop("Name"))) + " " + ((length(prop("Name")) == 1) ? "character" : "characters")
3
​
4
// Expanded
5
format(
6
length(prop("Name"))
7
) +
8
" " +
9
(
10
(
11
length(
12
prop("Name")
13
) == 1
14
) ?
15
"character" :
16
"characters"
17
)
This formula first uses the length() function to get the number of characters in the Name property. This is wrapped in the format function in order to convert the number to a string.
Second, an if statement again uses length() to check whether or not the number of characters in the Name property is equal to 1. If so, it outputs the singular “character”. If not, it outputs the plural “characters.”

Other formula components used in this example:

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.
Last modified 4mo ago