subtract

Learn how to use the subtract (-) operator in Notion formulas.

The subtract (-) operator allows you to subtract two numbers and return their difference.

number - number
subtract(number, number)
number.subtract(number)
Code language: JavaScript (javascript)

When used in mathematical equations, the - operator follows the standard mathematical order of operations (PEMDAS). For more detail, see Operator Precedence.

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

12 - 5 /* Output: 7 */

subtract(5, 12) /* Output: -7 */

12.subtract(5) /* Output: -7 */
Code language: JavaScript (javascript)

Since subtract is a binary operator, it can only work on two operands – the objects which are being operated on (if – the ternary operator – is the only operator that works on three operands).

If you need to work with more than two operands, the shorthand - is by far the easiest way to do it.

40 - 10 - 5 /* Output: 25 */

subtract(subtract(40, 10), 5) /* Output: 25 */

40.subtract(10).subtract(5) /* Output: 25 */
Code language: JavaScript (javascript)

The example database below tracks a weekend of treasure-spending by three pirates. Each starts with a Start Budget of $3,000, and the Leftover formula shows how much each has left after the weekend.

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

Note how I’ve set the number format of each column to U.S. Dollar. I’ve also set each column’s Calculate value to Sum, allowing me to see the total of all rows put together.

prop("Start Budget") - prop("Saturday") - prop("Sunday")
Code language: JavaScript (javascript)

Instead of using hard-coded numbers, I’ve called in each property using the prop() function.

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