Have you ever wished your Notion databases could do more than just store information? While text fields and numbers are great for collecting data, your database can actually do much more – in fact, it can think for itself.
That's where Notion formulas come in. They're like giving your database a brain, automatically crunching numbers, combining text, and making smart decisions based on your data.
In this guide, we’re going to show you everything you need to know to get started with Notion formulas.
You can follow along with our examples by copying this template database into your own Notion workspace.
To add a formula property to your database:
1. Open your database and add a new property
2. Choose "formula" as the type
3. Give the property a name
4. Click "edit formula" to begin writing your custom formula

Your formula can be just about anything you want it to be, as long as it contains at least one valid expression.
An expression will typically consist of one or more functions, but could be as simple as a string of text that says "Hello world!".

For example, if you create a formula with just the text "Hello world!", you'll see that exact text in this property for every page in the database.

While neat, this “formula” isn't particularly useful without any functions.
Let’s replace it with a simple function: id()

The id() function will fetch the unique page ID associated with every record in the database.

Exposing this ID can be extremely helpful when you’re automating your Notion database with tools like Make and need to look up a specific page.
Let’s take a look at some more advanced functions that will let your formulas automatically edit text, run mathematical calculations, format dates, and process conditional logic.
Let's start with some functions that revolve around editing text strings. One common need is extracting a subset of text from a longer string. Here's how to create a formula that grabs the first three characters of a product name to start creating a product ID:
1. Add a new formula property and edit the formula
2. Type "substring" - Notion will suggest the matching function
3. Enter your arguments, separated by commas:
• First argument: The text you want to extract from (e.g., the "Product Name" property)
• Second argument: The starting point (0 for the first character)
• Third argument: The ending point (3 to stop before the 4th character)

Note: Character positions in Notion start at 0, like in most programming languages. So position 0 is the first character, position 1 is the second character, and so on.
The resulting output will just include the first three letters of the “Product Name” property.

With Notion functions, you can also manipulate text cases. For instance, the `upper()` function converts text to uppercase. Let’s see it in action.
Add an upper() function at the beginning of your formula. The only argument required is the text that you want to capitalize. In our example, we’ll capitalize the substring extracted from Product Name, so we can wrap that entire function in upper’s parentheses.

The resulting output is the same substring as before, but now, all of the text is uppercase.

Let's make these IDs a bit more unique by including some text from the page ID field as well. Within the "upper" function, add a plus sign after the substring function to concatenate another piece of text.
Then, add another substring function - this one will take the last 5 characters of the Page ID, positions 27 to 32.
The final formula will look like this:

The resulting text combines both substrings together directly with no spaces in between.

If you want to add spaces or other characters between concatenated strings, just enter them as another string in the expression.
For instance, you might want to add a hyphen between the two extracted substrings.

The updated formula will add a hyphen between the two substrings, as pictured below.

Next, let's take a look at how you can use Notion functions to run mathematical calculations in your formulas. Let's start with some simple addition.
We'll make a "Total Price" field that adds up the values of the "Price" and "Shipping" properties.
The function for addition is just called add(). Then, each number you want to add up is entered as its own argument, separated by commas. We're just adding up two numbers here, but you can add up as many numbers as you’d like.

The output is the sum of both numbers.

Note that you can also skip using the function name and just use plus signs instead. You'll still get the exact same result, assuming you're adding numbers together.

However, if any of your arguments are text strings, then the output will also be a text string and not a number. That's how 3 + 4 will equal 34 instead of 7.
Multiplication works in largely the same fashion. We'll edit the Total Price formula to include sales tax as well. The multiply() function will work well for that.
You just need to enter two numbers you want to multiply, separated by commas. That will be the product Price multiplied by the sales tax rate.

The final output includes the total price with shipping and sales tax.

Of course, sales tax isn't the same in every state in the US. But accounting for variability like that is easy with Notion functions. We just need to use some conditional logic in an ifs() statement. This will let us set the value of a property dynamically based on any condition we want.
We'll edit the Sales Tax field and convert it into a formula field. The function will be ifs(). That will let us specify several conditions and corresponding values.
The pattern of arguments will go like this:
So in our example, we need to start by adding a condition to evaluate. With this double equals sign, we'll check if the "State" field is set to "CT"
Then, we need to provide a value to output if that condition is true. That will be Connecticut's sales tax rate of 6.35%.
In an ifs() function, you can provide as many condition and value pairs as you want. To make it easier to visually parse this function, you can hit shift+return to add new lines.
Notion formulas ignore spaces and new lines unless they're enclosed in quotes to make a string, so this is purely aesthetic formatting to make things easier to understand.
Once you've added all your specific conditions, you can wrap the function up with a single default value. If none of the other conditions are met, then the function will output this value. As such, it doesn't need a condition.
Here's a complete example, including 0 as the default value.

When you save the formula, try changing the “State” dropdown to see the tax and price properties update instantly.
Let's conclude with a brief overview of date/time formulas.
We'll start with a very easy one: now().

With now(), you can retrieve the current time up to the minute. This is another function that doesn't require an argument.

When you enter the `now()` function into a formula, that formula will recalculate the current time whenever the database is reloaded.

If you want to reference the time the page was created as a fixed value instead, use the "Created Time" property instead.

That property exists for every page in Notion, even if you haven't manually added a field for it.
Next, let's create a function that reformats the date generated by now() – or any other date/time value you want to reformat.
To reformat dates and time, you can use the formatDate() function. The first argument is the date/time you want to reformat - in this case, now(). The second argument is a formatting token enclosed in quotes.
You can check out this fantastic documentation from Thomas Frank for an extensive list of example formatting tokens.
For example, the format below shows 2 digits for the month and day, and 4 for the year, then shows 12-hour time with AM or PM as appropriate:

Save your formula to see the final output.

Notion formulas unlock a totally new level of functionality in Notion. If you need to reformat text, do some math, add conditional logic, or work with dates and times in your databases, then custom formulas are an indispensable tool. The examples we've covered here just scratch the surface of what's possible, but they should give you a solid foundation for creating your own formulas and automating your workflow in Notion. You can explore more options in Notion’s documentation.
If you’d like to learn more about automating your work with Notion, Airtable, Zapier, Pipedream and more, be sure to check out the other posts on our blog or our YouTube channel. You can also follow XRAY on Twitter, Facebook, or LinkedIn.


