unaryPlus

Learn how to use the unaryPlus (+) operator in Notion formulas.

The unaryPlus (+) operator is used to convert Booleans and numeric strings to numbers.

+string +Boolean unaryPlus(string) unaryPlus(Boolean)

Unlike toNumber, it cannot convert dates to numbers. Otherwise, it is functionally equivalent, and it can be written with the + operator for quick use.

You can also use the function version, unaryPlus().

Good to know: A unary operator only has a single operand, while a binary operator has two. unaryPlus and unaryMinus are, as their names imply, unary operators. Examples of binary operators include add, divide, pow, etc.

+"42" // Output: 42 +true // Output: 1 +false // Output: 0 unaryPlus("42") // Output: 42

unaryPlus() can be combined with other operators, including unaryMinus and even add, which uses the same + character.

20 + + "30" // Output: 50 -+"30" // Output: -30 20 + - + "30" // Output? -10 [Notion will rewrite this to 20 + -(+"30")]

Using unaryPlus() on a string value that contains any non-numeric characters will result in null output. However, that “null” output is still considered to be a number in terms of its data type.

This can cause formulas that contain additional functions or output to throw a Type Mismatch error.

Oddly, +"" returns 0 rather than null. This is contrary to the equivalent toNumber formula: toNumber("") returns null.

+"Monkey" // Output: null (but still Number type) +"42 Monkeys" // Output: null (but still Number type) +"" // Output: 0 +"Monkeys" + 22 // Output: 22 +"Monkeys" + " and rabbits loop the loop" // Output: Type Mismatch Error

The example database below tracks daily habits with a checkbox property for each habit. The Score property converts each checkbox’s Boolean value into a number, and then adds up a total score for the day.

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
+prop("Deck Swabbed") + +prop("Teeth Brushed") + +prop("Lime Eaten")

Other formula components used in this example:

add – Thomas Frank
thomasjfrank.com

Notion’s Phone Number property type outputs a string (see it listed in the API Reference for more detail).

The example database below uses unaryPlus and the replaceAll function to turn phone numbers into true numbers, even if they have additional formatting.

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
+replaceAll(prop("Phone"), "[() -]", "")

unaryPlus can’t operate on a string that contains non-numeric characters such as ( or -. So Number first uses the replaceAll function to remove them. It does this by passing a regular expression in its matching argument – "[() -]" – where the special bracket [] characters equate to:

“Match any character listed here.”

This includes the space.

Next, replaceAll()‘s replacement argument replaces all matched characters with an empty string – "" – in effect removing them. The result is a phone number converted to a purely numeric string – e.g. (482) 491-5813 is converted to 4824915813.

Finally, the + operator converts this numeric string into a true number.

Other formula components used in this example:

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