Notion formulas can accept (and return) four different types of data: String, Number, Boolean (aka Checkbox), and Date.
|Boolean (called Checkbox in Notion)||
Notion formulas almost never do automatic type conversion; you must convert data to other types manually. Learn how to do that here:
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 (