Less than or equal (<=)

Learn how to use the Boolean less than or equal (<=) operator in Notion formulas.

The less than or equal (`<=`) operator returns true if its left operand is less than or equal to its right operand. It accepts numeric, string, date, and Boolean operands.

``````number <= number
string <= string
Boolean <= Boolean
date <= date
```Code language: JavaScript (javascript)```
``````2 <= 3 /* Output: true */

42 <= 42 /* Output: true */

"a" <= "a" /* Output: true */

/* Boolean values equate to 1 (true) and 0 (false). */
false <= true /* Output: true */

true <= true /* Output: true */

// For dates, "less than" equates to "before".
now() <= now() /* Output: true */
```Code language: JavaScript (javascript)```

Good to know: When comparing dates, “greater” = “later”.

Good to know: The less than or equal (`<=`) operator cannot be chained in a Notion formula. A formula like `1 <= 2 <= 3` won’t work. Use the and operator to get around this – e.g. `1 <= 2 and 2 <= 3`.

This example database is an extremely simplified tax calculator. It uses the Gross Income for each person to determine that person’s tax bracket, and outputs their total tax liability in the Total Tax property.

Note: This example uses the 2022 Federal income tax brackets, but does not include deductions, exemptions, or credits.

``````// Compressed
(prop("Gross Income") <= 10275) ? (prop("Gross Income") * 0.1) : ((prop("Gross Income") <= 41775) ? (prop("Gross Income") * 0.12 + 1027.5) : ((prop("Gross Income") <= 89075) ? (prop("Gross Income") * 0.22 + 4807.5) : ((prop("Gross Income") <= 1.7005e+5) ? (prop("Gross Income") * 0.24 + 15213.5) : ((prop("Gross Income") <= 2.1595e+5) ? (prop("Gross Income") * 0.32 + 34657.5) : ((prop("Gross Income") <= 5.399e+5) ? (prop("Gross Income") * 0.35 + 49335.5) : (prop("Gross Income") * 0.37 + 1.62718e+5))))))

// Expanded
(prop("Gross Income") <= 10275) ? (prop("Gross Income") * 0.1) :
((prop("Gross Income") <= 41775) ? (prop("Gross Income") * 0.12 + 1027.5) :
((prop("Gross Income") <= 89075) ? (prop("Gross Income") * 0.22 + 4807.5) :
((prop("Gross Income") <= 1.7005e+5) ? (prop("Gross Income") * 0.24 + 15213.5) :
((prop("Gross Income") <= 2.1595e+5) ? (prop("Gross Income") * 0.32 + 34657.5) :
((prop("Gross Income") <= 5.399e+5) ? (prop("Gross Income") * 0.35 + 49335.5) :
(prop("Gross Income") * 0.37 + 1.62718e+5))))))
```Code language: JavaScript (javascript)```

This formula uses a series of nested if-then statements (using the conditional operators `?` and `:`) to “step through” a series of income caps.

For example: `(prop("Gross Income") <= 10275) ? (prop("Gross Income") * 0.1)` simply checks to see if Gross Income is less than or equal to \$10,275, which is the cap for the 10% tax bracket.

If so, then Gross Income is multiplied by 10% to return the total tax. If not, then the formula goes to the next bracket, checks Gross Income against its cap, and so on.