Logic functions in Notion formulas!

Notion Jul 6, 2023

In the previous article, we learned about basic mathematical operators that are used in formulas inside Notion! This article will introduce you to Logic functions. Similar to the previous article, I will explain every function along with an example for each function. 💯

This article is a part of the Fantastic Formulas series. This series features helpful articles about formulas in Notion.

Logic functions are a set of functions that allow you to perform Boolean logic operations in Notion formulas. Boolean logic operations are operations that return a value of either true or false. These functions are useful for creating conditions and making decisions in your formulas. The main logic functions available in Notion formulas are 🔽

  • if
  • equal
  • unequal
  • smaller/smallerEq
  • larger/largerEq
  • and
  • not
  • empty
  • or

Today we will only learn how to use the first 5 logic functions! Just like in the previous article, I will proceed with a simple database as an example to make it easily understandable and representable. This time, let's say we want to build a simple database for tracking inventory items in our Notion workspace. 👀

In this database shown below, you can see 3 properties. First property shows the name of items, second one shows the number of that item in the inventory and the third property shows the minimum amount of stock that should be maintained. ✅

Notion Formulas | Logic Functions in Notion formulas
Example - Simple Inventory database

1. if()

The IF function is used to test a condition and return one value if the condition is true and another value if the condition is false. The syntax of the IF function is

if(condition, "value_if_true", "value_if_false")
if() function syntax

Let's say we want a property that shows us the status of the item based on the amount of units present in the inventory. For a simple column that only shows if the stock is in excess, we can use a single 'if' statement. ✅

if(prop("Stock:") - prop("Minimum stock needed:") > 0, "Stock in excess", "")
Single if() statement example

As you can see below, the formula is perfectly working 🔽

Notion Formulas | Logic Functions in Notion formulas
Single if() statement results

Say we want to show the multiple statuses based on different amount of items in stock for all of the items. For that, we can use nested 'if' statements. ✅

if(prop("Stock:") - prop("Minimum stock needed:") > 0, "Stock in excess",
if(prop("Stock:") == prop("Minimum stock needed:"), "Item in stock",
if(prop("Stock:") - prop("Minimum stock needed:") < 0, "Stock refill needed", "")))
Nested if() statements example

As you can see below, the formula is perfectly working 🔽

Notion Formulas | Logic Functions in Notion formulas
Nested if() statements results

2. unequal() & equal()

The 'unequal' and 'equal' functions are used to compare two values and return true if they are not equal or equal respectively. The syntax of these functions is

unequal("value1", "value2")

equal("value1", "value2")
equal & unequal functions - syntax

Let's say we want to check for items that have the exact amount of units in the inventory as needed. For that, we can simply use the 'equal' function like shown below:

equal(prop("Stock:"),prop("Minimum stock needed:"))
equal() statement example

As you can see below, the formula is perfectly working 🔽

Notion Formulas | Logic Functions in Notion formulas
equal() statement results

Now what if we don't want to check for the items that have the exact amount of units in the inventory as needed? Say we want to check for the items that don't match the exact amount of units needed. For that, simply swap 'equal' with 'unequal'. ✅

unequal(prop("Stock:"),prop("Minimum stock needed:"))
unequal() statement example

As you can see below, the formula is perfectly working 🔽

Notion Formulas | Logic Functions in Notion formulas
unequal() statement results

3. larger() & smaller()

LARGER, SMALLER: The LARGER and SMALLER function is used to compare two numbers and return true if one number is greater than or smaller than the other. The syntax of these functions is

larger("value1", "value2")

smaller("value1", "value2")
larger() & smaller() functions - syntax

Say we want to see which items have excess units in the inventory. For that, we can simply use a 'larger' statement as shown below:

larger(prop("Stock:"), prop("Minimum stock needed:"))
larger() statement example

As you can see below, the formula is perfectly working 🔽

Notion Formulas | Logic Functions in Notion formulas

But what if we want to check for the items that have less amount of units than the minimum requirement? We can do that by simply swapping out 'larger' with 'smaller' as shown below:

smaller(prop("Stock:"), prop("Minimum stock needed:"))
smaller() statement example

As you can see below, the formula is perfectly working 🔽

Notion Formulas | Logic Functions in Notion formulas
smaller() statement results

4. largerEq() & smallerEq()

The 'largerEq' and 'smallerEq' functions are used to compare two numbers and return true if one number is greater than or equal to and smaller than or equal to the other respectively. The syntax of these functions is

largerEq("value1", "value2")

smallerEq("value1", "value2")
largerEq & smallerEq functions - syntax

Say we want to check for all the items that meet the minimum stock requirement as well as the items that are excess in stock. For that, we can use a simple statement with the 'largerEq' function as shown below:

largerEq(prop("Stock:"), prop("Minimum stock needed:"))
largerEq() statement example

As you can see below, the formula is perfectly working 🔽

Notion Formulas | Logic Functions in Notion formulas
largerEq() statement results

Similarly, you can swap 'largerEq' with 'smallerEq' to check for items that meet the minimum stock requirement exactly and the items that need a stock refill. ✅


Conclusion

Now you know how to use the fist four Logic functions to build formulas in Notion! Using these functions will allow you to add a lot of features in your work space and personal space! The ability to use custom formulas in Notion databases adds another dimension to the personalisation and customizability inside Notion. So make sure you unlock the full potential of Notion with the help of formulas! 🔥

I hope this article was helpful and easy to understand. At Prototion, we are on mission to make Notion easy for everyone! So we regularly post Helpful articles about Notion like this one. 📄

Remember to check out the Fantastic Formulas series for more articles about Notion formulas. Doesn't matter if you are a Notion beginner or a pro, I believe you will fin this series helpful. Also, don't forget to follow us on 🐦 Twitter for daily updates, latest Notion template launches and amazing deals & discounts on Premium Notion templates! 😍

Tags

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.