Formula Components

Formulas and Databases

Reference

Formula Examples

floor

Learn how to use the floor function in Notion formulas.

The

`floor()`

function returns the largest integer that is less than or equal to its argument.1

floor(number)

In other words,

`floor()`

rounds a non-whole number to the next smallest integer. When used on an integer, it will return that integer.1

floor(4.2) // Output: 4

2

β

3

floor(3.845) // Output: 3

4

β

5

floor(4) // Output: 4

Itβs worth noting that

`floor()`

rounds βdownward towards negative infinityβ, while its counterpart, ceil, rounds βupward towards positive infinityβWhen a negative value is passed as

`floor()`

's argument, youβll still get a smaller value.1

floor(-3.7) // Output: -4

`floor()`

In JavaScript, the Math.trunc function rounds βtowardsβ zero. It simply removes all decimal values from a non-whole number - e.g.

`Math.trunc(3.7) == 3`

and `Math.trunc(-3.7) == -3`

.1

// Assume a number property exists called Num

2

prop("Num") >= 0 ? floor(prop("Num")) : ceil(prop("Num"))

As stated above, Notion does not currently provide a

`trunc()`

function. The example database below provides a working example of a

`trunc()`

polyfill (a.k.a. custom code that replicates the functionality of a missing function), which uses both `floor()`

and ceil.Floor and ceiling values are also provided for reference.

floor

College Info Geek on Notion

// Written with ternary operator (? and :)

prop("Num") >= 0 ? floor(prop("Num")) : ceil(prop("Num"))

β

// Written with if() and expanded

if(

prop("Num") >= 0,

floor(

prop("Num")

)

ceil(

prop("Num")

)

)

A proper

`trunc()`

function (which does not exist in Notion) would simply chop all of the digits after the decimal off of a number and return the integer.To create an effective polyfill for this function, we must first determine if our input number is positive or negative. We do this with

`prop("Num") >= 0`

, though the same could be accomplished with the sign function: `sign(prop("Num")) == 1`

If the input number is positive, we pass it as an argument to

`floor()`

.You can check this in the example table above by comparing the output in the **Trunc** column to that of the **Floor** and **Ceil** columns.

β 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 Values

Example Database

View and Duplicate Database

βTruncβ Property Formula