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.

length(string)
length("Monkey D. Luffy") // Output: 15 length("Supercalifragilisticexpialidocious") // Output: 34 length("Doctor Doom") // Output: 11

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”.

Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.
A new tool that blends your everyday work apps into one. It’s the all-in-one workspace for you and your team
thomasfrank.notion.site
// Compressed format(length(prop("Name"))) + " " + ((length(prop("Name")) == 1) ? "character" : "characters") // Expanded format( length(prop("Name")) ) + " " + ( ( length( prop("Name") ) == 1 ) ? "character" : "characters" )

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:

if – Thomas Frank
thomasjfrank.com
format – Thomas Frank
thomasjfrank.com
add – Thomas Frank
thomasjfrank.com
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