concat

Learn how to use the concat function in Notion formulas.

The concat() function concatenates (aka combines) its arguments. It accepts one or more string arguments, and outputs a single combined string.

concat(string) concat(string, string) concat(string, string, ...)

concat() can accept any number of arguments.

Good to know: You can also concatenate strings with the add (+) operator.

concat("Roronoa ","Zoro") // Output: Roronoa Zoro "Roronoa " + "Zoro" // Output: Roronoa Zoro concat("Chopper") // Output: Chopper (this is pointless, but it works) concat("Monkey", " D.", "Luffy", " will ", "be", " King of the Pirates") // Output: Monkey D. Luffy will be King of the Pirates // use "\n" to create line breaks concat("Luffy \n", "Zoro \n", "Sanji \n", "Nami \n") // Output: // Luffy // Zoro // Sanji // Nami

You can use conversion functions like format or formatDate to convert other data types into strings before concatenating them:

concat("Today is ", formatDate(now(), "MMMM DD, YYYY")) // Output: Today is June 17, 2022 (this will change with the value of now())

This example database collects several different pieces of customer information, including first name, last name, phone number, and location. The Info formula neatly formats all of this information into a single cell.

To display phone numbers in a more consistent manner, there is a helper property – Ph Format – which formats the data from the Phone property. Info then pulls from Ph Format rather than Phone directly.

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 concat("🧑 ", prop("First Name"), " ", prop("Last Name"), "\n📍 ", prop("Location"), "\n☎️ ", prop("Ph Format")) // Expanded concat( "🧑 ", prop("First Name"), " ", prop("Last Name"), "\n📍 ", prop("Location"), "\n☎️ ", prop("Ph Format") )

Here, we simply use concat() with multiple arguments to combine all of our properties. We also pass some useful formatting strings as arguments, such as "🧑 " and "\n📍 ". The \n characters create new lines.

// Compressed "(" + slice(replaceAll(prop("Phone"), "[() .-]", ""), 0, 3) + ") " + slice(replaceAll(prop("Phone"), "[() .-]", ""), 3, 6) + "-" + slice(replaceAll(prop("Phone"), "[() .-]", ""), 6, 10) // Expanded "(" + slice( replaceAll( prop("Phone"), "[() .-]", "" ), 0, 3 ) + ") " + slice( replaceAll( prop("Phone"), "[() .-]", "" ), 3, 6 ) + "-" + slice( replaceAll( prop("Phone"), "[() .-]", "" ), 6, 10 )

The Ph Format formula is a slightly more complex formula that uses the add (+) operator for concatenation instead of concat(). In many cases, you’ll find + to be a far quicker way to combine strings.

Here’s how the formula formats the phone numbers, which are originally string values from the Phone property:

  1. We use the slice function multiple times to chop the phone number into three discrete pieces.
    • For each piece, we use replaceAll and the regular expression"[() .-]" to remove any non-numeric characters. The brackets ([]) indicate that every matched instance of any character between them should be replaced.
  2. Next, we use the + operator to concatenate these number slices with useful formatting (e.g. "(" and "-") to get our standard format: (xxx) xxx-xxxx.

Other formula components used in this example:

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