Formula Components

Formulas and Databases

Reference

Formula Examples

mod

Learn how to use the mod (%) operator to obtain a remainder in Notion formulas.

The **remainder (****)** operator allows you to get the **remainder** after dividing the first operand with the second operand.

`%`

1

number % number

2

mod(number, number)

Notion provides a

`mod()`

function as well as `%`

and `mod`

operators (I'll just reference `%`

for the rest of this article). Somewhat confusingly, these do not return a true modulus value; they return a remainder (see: Remainder or Modulus? below).

As

`%`

and `mod()`

output a remainder, their output values will take the sign (`+/-`

) of the dividend.For reference, the **dividend** is the number being divided by the **divisor**, which produces the **quotient**:

$\frac {dividend}{divisor} = quotient$

1

19 % 12 // Output: 7

2

β

3

19 mod 12 // Output: 7

4

β

5

mod(-19,12) // Output: -7

If the divisor is negative:

`mod()`

will treat it as a negative integer natively.- if you're using the
`%`

operator, you'll need to wrap your divisor in parentheses`()`

in order to explicitly define your divisor as a negative integer.`x % (-y)`

will work exactly like`mod().`

`x % -y`

will cause Notion to rewrite your formula as`x / 100 - y`

, which will output an incorrect result. This is because the`-`

is treated as a unaryMinus operator, and Notion's math engine can't correctly deal with it when it's appended to the divisor.

1

19 % (-12) // Output: 7

2

β

3

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

4

// be wrapped in () symbols

5

β

6

prop("negative num") == -12

7

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

8

β

9

19 % -12 // Rewritten as 19 / 100 - 12, outputs -11.81

10

β

11

mod(19,-12) // Output: 7

Note: The above rules only apply if you're hard-coding a negative divisor in a formula. If you pass one via a property, it'll be parsed as a true negative value. It won't add a unaryMinus operator to your formula.

βJust as in JavaScript, Notionβs **remainder** of two numbers, not the **modulus.** Confusingly, the

`%`

operator calculates the `mod()`

function does this as well, despite its name.The **remainder** and **modulus** of two numbers will be identical when both the dividend and divisor have the same sign (

`+/-`

). If their signs differ, however, the modulus will differ from the remainder.Mod and Remainder are not the Same

Big Machine

Remainder operator vs. modulo operator (with JavaScript code)

You can prove this using WolframAlpha:

`-19 mod 12`

results in`5`

`QuotientRemainder[-19,12]`

results in`-7`

To calculate a true modulus in Notion, use

`((x % y) + y) % y`

instead:1

// Using the % operator

2

((19 % 12) + 12) % 12

3

β

4

// Using the mod() formula

5

mod(mod(19, 12) + 12, 12)

6

β

7

// % operator example using hard-coded negative divisors

8

((19 % (-12)) + (-12)) % (-12)

As noted above in the **Negative Divisors **section, hard-coded negative divisors in

`%`

expressions need to be wrapped in parentheses `()`

so Notion can parse them explicitly as negative integers (see code line `7`

in the above code block). Otherwise, Notion will interpret the

`-`

as a unaryMinus operator, rewrite your formula to `(x / 100 - y + -y) / 100 - y`

, and return an incorrect result. However, this isn't necessary when using the `mod()`

function.Remainder vs. Modulo programming functions

This example database shows the differing outputs of **remainder **and true **modulus **expressions.

mod

College Info Geek on Notion

You can check these results here:

Modulo Calculator

CalculatorSoup

1

prop("Dividend") % prop("Divisor")

1

(prop("Dividend") % prop("Divisor") + prop("Divisor")) % prop("Divisor")

Instead of using hard-coded numbers, Iβve called in each property using the

`prop()`

function.β 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 21d ago

Copy link

On this page

Example Formulas

Negative Divisors

Remainder or Modulus?

Example Database

View and Duplicate Database

"Remainder" Property Formula

"Modulus" Property Formula