join

Learn how to use the join function in Notion formulas.

The join() function takes its first argument and inserts it in between each of its additional arguments. It accepts only string arguments.

join(string, string, string)

join() can accept one or more arguments, but needs at least three to perform its intended function.

join() acts much like JavaScript’s Array.prototype.join() method, with all but the first argument acting as the elements inside an array. Note that Notion’s join() function does not use a default separator (e.g. ,), so you’ll always need to define one.

join(", ","Luffy","Zoro","Nami","Chopper") // Output: Luffy, Zoro, Nami, Chopper // Use "\n" to add line breaks join("\n","Luffy","Zoro","Nami","Chopper") // Output: // Luffy // Zoro // Nami // Chopper

This example database creates a roster for different missions. Each member in the pirate crew can mark whether or not they’re attending, and the Roster formula will output a list of those attending and not attending.

The join() function is used to create line breaks.

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 join("\n", (prop("Luffy") == true) ? "Luffy attending" : "Luffy not attending", (prop("Sanji") == true) ? "Sanji attending" : "Sanji not attending", (prop("Zoro") == true) ? "Zoro attending" : "Zoro not attending", (prop("Chopper") == true) ? "Chopper attending" : "Chopper not attending") // Expanded join( "\n", (prop("Luffy") == true) ? "Luffy attending" : "Luffy not attending", (prop("Sanji") == true) ? "Sanji attending" : "Sanji not attending", (prop("Zoro") == true) ? "Zoro attending" : "Zoro not attending", (prop("Chopper") == true) ? "Chopper attending" : "Chopper not attending" )

This join() example inserts "\n" between each string to create line breaks.

For fun, here’s another take on the Roster formula that uses replace and replaceAll – along with some advanced regular expressions – to create a single sentence that includes only the members who are attending (complete with commas):

// Compressed replace(replace(replace(replaceAll(join(", ", (prop("Luffy") == true) ? "Luffy" : "", (prop("Sanji") == true) ? "Sanji" : "", (prop("Zoro") == true) ? "Zoro" : "", (prop("Chopper") == true) ? "Chopper" : ""), "(^, | ,)", ""), "[,].$", ""), ",(?!.*,)", ", and"), "^([^,]*), and", "$1 and") // Expanded replace( replace( replace( replaceAll( join( ", ", (prop("Luffy") == true) ? "Luffy" : "", (prop("Sanji") == true) ? "Sanji" : "", (prop("Zoro") == true) ? "Zoro" : "", (prop("Chopper") == true) ? "Chopper" : "" ), "(^, | ,)", "" ), "[,].$", "" ), ",(?!.*,)", ", and" ), "^([^,]*), and", "$1 and" )

Other formula components used in this example:

if – Thomas Frank
thomasjfrank.com
replace – Thomas Frank
thomasjfrank.com
replaceAll – 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