# What is a Notion Formula?

Learn the definition of a Notion formula and what formulas can do in your databases.

Notion formulas are bits of code that can make your Notion databases much more useful.

Formulas in Notion are like a limited programming language. They're written and used in Formula properties within Notion databases (learn about databases with my complete beginner's guide).

This formula calculates simple interest (

$Prt$

) using data from the Investment, Interest Rate, and Years properties.Using formulas, you can do things in your Notion databases that are otherwise impossible.

This site is a

**comprehensive**reference for creating, using, and debugging Notion formulas.You'll also find reference guides on things like operator precedence, data type conversion, debugging, and regular expressions.

Let's say you're a sales manager with several existing clients. You want to make sure you check in with each client every three months.

Notion formulas will let you create a database view like this (

**assume "today" is August 18, 2022**- the day I wrote this guide):**View and duplicate this example:**

Not only is your

**Next Check-In**date automatically calculated based on your**Last Check-In,**but the view is also grouped (using Notion's grouping feature) so that you can easily see any check-ins that need to happen within the next seven days.Two formulas power this database view:

**Next Check-In**and**Next 7 Days.**The Next Check-In formula looks at the date set in the

**Last Check-In**property and calculates the next date by adding three months. To accomplish this, it uses the dateAdd function.1

dateAdd(prop("Last Check-In"), 3, "months")

The Next 7 Days formula is slightly more complex. Using the if function, it uses branching logic to output one of two different strings.

If the date displayed in Next Check-In is less than eight days away (from today's date), then the formula outputs, "Next 7 Days".

Otherwise, it outputs, "More than 7 Days Out".

To determine how far out the Next Check-In date is, we use the dateBetween function as the first argument in our if-statement.

1

// Compressed

2

if(dateBetween(prop("Next Check-In"), now(), "days") < 8, "Next 7 Days", "More than 7 Days Out")

3

4

// Expanded

5

if(

6

dateBetween(

7

prop("Next Check-In"),

8

now(),

9

"days"

10

) < 8,

11

"Next 7 Days",

12

"More than 7 Days Out"

13

)

Now that we have a formula which can output two different strings of text, we use them in this database view's

**Group By**setting:Throughout this reference, I'll mention many different terms related to Notion formulas. Here are a few of the most important terms and what they mean.

I use the term "components" to collectively refer to the following tools that you have at your disposal when constructing formulas:

- Operators - symbols that perform operations on 1-3 operands. Includes mathematical operators (such as add), Boolean operators (such as not), and the ternary operator (if).

- Boolean (Checkbox) - Notion refers to these as "Checkbox" values, but under the hood, they're classic Boolean true/false values.

Understanding data types is crucial for comfortably working with Notion formulas. Every property outputs a specific data type (except Formulas and Rollups, which can output several).

Additionally, every operator and function accepts specific data types in its argument(s). They also output data of a specific type - and that type is often different than the data types taken as inputs.

You can see an example of every property type within Notion referenced in a formula in this database:

1

dateAdd(now(),5,"days")

This function requires three arguments, which

*must*be (in this order):- 1.A date
- 2.A number
- 3.A string (this must also be one of the accepted units, such as "days" or "years")

If the arguments are not passed data of the correct type, the formula will throw a

**Type Mismatch error.****Good to know:**Unlike many programming languages, Notion does

*not*do automatic type conversion within formulas. You'll need to provide data of the correct type within all function arguments.

*The only exceptions to this are the*

*test*

*,*

*replace*

*, and*

*replaceAll*

*functions. These are advanced functions, so I won't cover their details here.*

You'll also need to make sure the final output of your formula has only one data type.

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 2mo ago