# abs

Learn how to use the abs function in Notion formulas.

The abs() function calculates the absolute value of a number.

.wp-block-code {
border: 0;
}

.wp-block-code > div {
overflow: auto;
}

.shcb-language {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
-webkit-clip-path: inset(50%);
clip-path: inset(50%);
height: 1px;
margin: -1px;
overflow: hidden;
position: absolute;
width: 1px;
word-wrap: normal;
word-break: normal;
}

.hljs {
box-sizing: border-box;
}

.hljs.shcb-code-table {
display: table;
width: 100%;
}

.hljs.shcb-code-table > .shcb-loc {
color: inherit;
display: table-row;
width: 100%;
}

.hljs.shcb-code-table .shcb-loc > span {
display: table-cell;
}

.wp-block-code code.hljs:not(.shcb-wrap-lines) {
white-space: pre;
}

.wp-block-code code.hljs.shcb-wrap-lines {
white-space: pre-wrap;
}

.hljs.shcb-line-numbers {
border-spacing: 0;
counter-reset: line;
}

.hljs.shcb-line-numbers > .shcb-loc {
counter-increment: line;
}

.hljs.shcb-line-numbers .shcb-loc > span {
}

.hljs.shcb-line-numbers .shcb-loc::before {
border-right: 1px solid #ddd;
content: counter(line);
display: table-cell;
text-align: right;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
width: 1%;
}abs(number)


A number’s absolute value is simply how far it is away from zero. Therefore, the absolute value of a negative number is equal to its positive equivalent – e.g. abs(-5) == 5.

In mathematical notation, absolute values are expressed by wrapping a number in || signs:

$$|-12\;| = 12$$
abs(-42) // Output: 42

abs(42) // Output: 42


Notion’s dateBetween function subtracts the second argument from the first, and returns a number depending on the specified unit of time (e.g. “hours” or “seconds”).

If the second argument is a later date than the first argument’s date, dateBetween() will return a negative number. The formula in the table below uses the abs() function to ensure that the output is always positive.

abs(dateBetween(prop("Date 1"), prop("Date 2"), "seconds"))