Data Types

Learn about the four data types supported in Notion formulas.

Notion formulas can accept (and return) four different types of data: String, Number, Boolean (aka Checkbox), and Date.

Data Type Examples
String "King of the Pirates"
Number 9001
Boolean (called Checkbox in Notion) true, false
Date "2022-11-11T12:00:00Z"

Notion formulas almost never do automatic type conversion; you must convert data to other types manually. Learn how to do that here:

Converting Data Types – Thomas Frank
thomasjfrank.com

The only exceptions to this are within the test, replace, and replaceAll functions, which do limited automatic type conversion. These are advanced functions, so I won’t cover their details here.

This fact has several implications:

First, a formula must output data of a single type. The following will throw a Type Mismatch error:

// Type Mismatch "Monkey D. Luffy is " + 19 + " years old."

You will need to convert the number to a string in order to make this formula work.

// Valid "Monkey D. Luffy is " + format(19) + " years old."

Now the formula is outputting string data only.

Second, operators must have operands of the same type, and arguments within functions must be of the type specified by the function.

// Type Mismatch "42" == 42 // Valid - unaryPlus operator (+) converts the string to a number +"42" == 42 // Also valid - format() converts 42 to a string "42" == format(42) --- // Type Mismatch - dateBetween's first and second arguments must be dates, not simply strings containing representations of dates dateBetween("June 1, 2022", "June 30, 2022", "days") // Valid - the function is now using dates in its first two arguments (assume a date property called "Date" exists) dateBetween(prop("Date"), now(), "days")

Good to know: Since Notion formulas don’t do automatic type conversion, the equals (==) operator tests for strict equality (see the Javascript reference page on this).

E.g. "1" == 1 will throw a Type Mismatch error in Notion. In JavaScript, it would return true.

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