# unaryMinus

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

1

-number

2

unaryMinus(number)

Unary negation

*negates*a number; it does not simply make it negative. This means you can use it to make a negative number positive.This is useful to keep in mind since unaryPlus does not make a number positive; it converts non-numeric data to a number.

You can also use the function version,

`unaryMinus()`

.1

-42 // Output: -42

2

3

-(-42) // Output: 42

4

5

unaryMinus(42) // Output: -42

It's important to know that Notion's formula editor will sometimes interpret the

`-`

symbol as a unaryMinus in situations where you're trying to express a truly negative value.1

19 % -12 // Outputs incorrect value of -11.81

2

19 % (-12) // Correctly outputs 7

3

4

// Negative value passed via a property does not need to

5

// be wrapped in () symbols

6

7

prop("negative num") == -12

8

19 % prop("negative num") // Output: 7

As shown in the code block above, this does not apply to negative values passed via a property. Those values will be truly negative since a property can't add a unaryMinus operator (or any operator) to your formula.

Good to know: Parentheses

`()`

have the highest operator precedence in Notion formulas, so you can avoid all sorts of confusion by using them to make the order of your formula's operation explicitly defined.Unlike in JavaScript, unaryMinus does not convert other data types (such as strings or Booleans) to numbers in Notion.

1

-+"42" // Output: -42

2

3

-+"-42" // Output: 42

4

5

-+true // Output: -1

6

7

-toNumber(now()) // Output: -165479808000 (will change with now()'s timestamp)

1

// Compressed

2

3

if(prop("Num 1") - prop("Num 2") < 0, -(prop("Num 1") - prop("Num 2")), prop("Num 1") - prop("Num 2"))

4

5

// Expanded

6

7

if(

8

prop("Num 1") - prop("Num 2") < 0,

9

-(

10

prop("Num 1") - prop("Num 2")

11

),

12

prop("Num 1") - prop("Num 2")

13

)

This formula checks whether the difference between Num 1 and Num 2 is less than zero. If it is, it applies the

`-`

operator to the entire equation in order to get the absolute value. 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.

Last modified 4mo ago