Notion VIP Logo
BulletproofA-to-ZConsultingProductivity Nexus
0
Subscribe

Notion Formulas 2.0: The Definitive Introduction

Formulas are essential to harnessing the power of Notion, but they're also the most daunting part of Notion for many users. With this primer, you'll get a solid understanding of the fundamentals of Notion formulas, and then in other tutorials, I'll dive into specific functions and how to use formulas in automations, so be sure to subscribe on YouTube and to the Notion VIP newsletter.

Throughout this one, I'm going to use two databases to demonstrate each concept: a database of e-commerce orders and a related database of customers. For you to reference as you practice these concepts, they're available as templates to members of Notion A-to-Z, along with all other Notion VIP resources for getting the most from Notion.

Why use formulas?

You know my #1 rule for Notion is to:

  1. structure all information in related master databases; then
  2. access it through contextually filtered views.

That's the crux of my Bulletproof framework, and among the endless benefits is that you can leverage formulas within properties and in automations.

So why use formulas? They can:

Where are formulas used?

Within Notion databases, you can use formulas in two places:

  1. as a property of the database; and
  2. within the database's automations.

For this primer, we're going to focus on the Formula property because that's where they're used most commonly, and if you can use formulas there, you can easily use them in automations. I'll have tutorials dedicated specifically to automations.

What are Notion formulas?

When you add a property to a database, you can choose the Formula type. A formula is an operation performed on input values to return an output value. Like every other property, a formula ultimately contains a single value for each item in the database. Each time you load the database, it executes the formula for each item to determine its value.

How to use Notion formulas.

When you configure the Formula property, you write the formula with Notion's formula language. It's sort of a template with placeholders where you want to reference other properties as inputs. When it executes for each item, it uses that item's property values. You can write the formula from the main property configuration menu or simply by clicking into any cell of the property. That'll bring up the formula editor.

The Formula Editor

You compose the formula at the top. At the bottom-left is a list of features you can use in the formula, like the properties you can reference and functions, which we'll talk about in just a second. When you hover over an item, helpful information appears to the right. And you can click it to add it to your formula.

So, formulas have two core components: input values and the operations to perform on them.

Before we dive into inputs and operations, let's talk about value types.

Value Types

Every input and output value is a particular type of data. The types you'll use most are:

It's important to stay mindful of value types because the operations you perform on your inputs require certain types. And your options for formatting and reusing your output value depend on its type as well. I'll mention value types often as we unpack formulas, and in the tutorials that cover specific functions and automations.

Input Values

Your inputs can be static, like the 2s in our 2 + 2 formula, where they're the same every time the formula runs. When you use static text, like if we merge "My dog " and "is Whaley", we use double quotes.

But what makes formulas so useful is that we can use other properties as inputs, so when the formula executes for each item, it uses the item's property values. To total our e-commerce orders, we choose the Subtotal property, then type a + sign, then Tax + Shipping. This works because all of these input values are of the number type. But you might notice that the Tax property is also a formula. It takes the Subtotal property and multiplies it by the static value .07 to return a number. We can also type property references directly into the formula editor. Start with the keyword prop, then in parentheses include the name of the property in double quotes.

Those are static and dynamic input values. Let's talk about the actions we perform in them.

Operations

Arithmetic Operators

When we added numbers to calculate the order Total, we used + signs. To calculate Shipping, we multiplied with the *. Those + signs and * were arithmetic operators, which are the symbols you're familiar with for mathematical calculations. We also have the - for subtraction and the / for division.

Concatenation Operator

You may have noticed that we also used the + sign to combine "My dog " and "is Whaley." When it's used to merge, or concatenate, text values, the + sign is known as the concatenation operator.

Arithmetic operators return numbers and the concatenation operator returns text.

Comparison Operators

We also have boolean operators that compare values to return true or false. To compare 2 and 3, we can use >, <, >=, <=, == to see if they're equal, or != to see if they'll unequal.

Logical Operators

And then we have logical operators used with true and false values. && represents "and" and || represents "or." So && returns true if both values are true. || returns true if either value is true.

But instead of using true and false explicitly, you'll typically use logical operators with inner expressions that return a boolean. An expression is sort of a formula within a formula, or a nested formula, that returns a value used by the outer formula. So we can replace this true with a comparison in parentheses. That evaluates to true, which is then used by the rest of the formula.

You'll see why returning true or false is so useful when I cover the incredibly useful if() function, which returns a value based on conditions. You'll find the full list of arithmetic, comparison and logical operators in the Formula Cheat Sheet on Notion VIP.

So operators are one way specifying the operations to perform on your input values. Functions are another way.

Functions

They're like packaged actions that begin with a keyword, and then within parentheses, you provide your inputs, which are called the function's arguments.

With the add() function, we can replace our 2 + 2 by providing it two 2s separated by a comma.

Notion offers many functions for every data type. You'll find them all within the left column of the formula editor. When you hover over one, you'll see a description of what it does and the arguments it accepts. Like I said I'll cover many functions in dedicated tutorials, but two of the simpler ones I use often are dateAdd() and dateSubtract().

If we search for dateAdd() we can see it adds time to a date. The first argument is the date, which will typically reference a Date property. The second argument is the quantity to add. And the third is the unit for that quantity, lowercase in quotes. So if these orders can be returned within 30 days, we can calculate the return deadline by supplying dateAdd() with the Order Date, the number 30, and the text string "days".

Dot Notation

Lastly, for this primer, I want to show you how you can create a chain of functions using dot notation.

Remember, each function returns a single output value. In the case of our Return Deadline, it's a date. If we attach to that function a period and another function, the output of the first function becomes the first argument of the next function.

dateSubtract() takes the same three arguments as dateAdd(); it just subtracts the quantity instead of adding it. So if we add a . and dateSubtract(), the first argument is already covered by the date resulting from the preceding dateAdd() function. So we just need the second two arguments. I'll use 30 and "days", which takes us back to our order date. With this dot notation, you can create long function chains that are easy to write, comprehend, and update.

Ready to Write 💪

With that, you're well primed to leverage formulas to make the most of Notion's capabilities. For you to reference as you practice, the databases of e-commerce orders and customers are available to members of Notion A-to-Z.

In other tutorials, I dive into specific functions, including if(), which is enormously useful by returning an output value based on the conditions of other properties. I also demonstrate how to use formula in automations, so be sure to subscribe on YouTube and to the Notion VIP newsletter. And if you're not yet a member of Notion A-to-Z, consider joining us for full access to Notion VIP resources so you can get the most from Notion.

All-in on
the all-in-one
productivity app.
Subscribe →