What we do
Tools
Industries
Department
How we workLet's talk →
Home/Notion/Notion Formula Examples for Formulas 2.0
Notion

Notion Formula Basics, With Examples You Can Paste In

You want a column that says how many days are left, or flags a task as overdue, and the editor keeps answering with a red error. A Notion formula is a property that calculates its value from the other properties on the same page, and through relations, from related pages too. The current syntax, Formulas 2.0, reads like a small programming language: properties, functions, and lists you can filter and add up.

Notion formula syntax in brief

Add one: in the database, add a property, choose Formula, then Edit formula.

Slider icon Edit properties New property Formula

Point at a property: type prop("Due Date"). The editor shows it as a token with the property's name.

Reach related pages: use a dot, as in prop("Tasks").length(). Inside map() or filter(), current means each item in turn.

Check the output: turn on Show types in the editor to see whether you're getting text, a number, a date or a list.

Notion formulas to copy, by what you want the column to say

You want Paste this Before it works
Days left until a due date dateBetween(prop("Due"), today(), "days") The later date goes first. Once the task is overdue the number turns negative.
A red Overdue label if(and(now() > prop("Due"), prop("Status") != "Done"), style("Overdue", "red", "b"), "") "Done" has to match your status option's name exactly.
High, Medium or Low from a score ifs(prop("Score") >= 80, "High", prop("Score") >= 50, "Medium", "Low") Score must be a number property. If it's text, wrap it: toNumber(prop("Score")).
Total hours across related tasks prop("Tasks").map(current.prop("Hours")).sum() Tasks has to be a relation. You don't need a rollup for this any more.
How many related tasks are done prop("Tasks").filter(current.prop("Status") == "Done").length() Pair it with the total from prop("Tasks").length() for a progress figure.
An amount from rate and hours lets(rate, prop("Rate"), hours, prop("Hours"), rate * hours) Correct math, but only as fresh as whoever last typed the rate.
A date written the way your team reads it formatDate(prop("Due"), "MM/DD/YYYY") The result is text, so you can't sort or filter it as a date.

A Notion rollup, or a formula that reads the relation

Rollup

Pick from menus

  • Choose the relation, the property and a calculation such as sum, average or count.
  • No syntax to learn, and anyone on the team can read it.
  • One calculation per rollup property, with no filtering first.
Formula

Write the logic

  • Filter related pages, then add up or count only the ones that match.
  • Combine several properties and conditions in one column.
  • Harder to read later, so name it plainly.

Use a rollup when a plain total does the job. Use a formula when you need "only the open ones" or "only this quarter" before the math.

Why a Notion formula errors out or shows nothing

Text and numbers mixed

How you'll know: The editor flags a type error on a comparison or a plus sign.

Fix: Turn text into a number with toNumber(), or a number into text with format(), before you combine them.

One of the inputs is empty

How you'll know: Most rows calculate and a few stay blank.

Fix: Rows with no date or number have nothing to work with. Guard for it: if(empty(prop("Due")), "", dateBetween(prop("Due"), today(), "days")).

A renamed status option

How you'll know: The overdue flag stopped showing after someone renamed Done to Complete.

Fix: Text inside quotes doesn't follow a rename. Update the string in the formula to the new option name.

A formula from an old tutorial

How you'll know: You pasted it exactly and it still won't save.

Fix: Examples written before Formulas 2.0 may not paste in cleanly, and many rely on a rollup step you no longer need. Rebuild it with prop(), dot notation and list functions.

The input no Notion formula can fetch

A formula can only read the page it sits on and pages linked to it. Today's exchange rate, a client's open balance in the billing system, or the hours from your time tracker aren't in Notion, so someone types them into a property and the formula calculates from whatever was typed last. The math is right and the answer is stale.

n-frames fills those properties from the source through the Notion API, on a schedule or when the number changes in the other system, so the formula works from today's figure. When a calculated status should start something outside Notion, a follow-up, an invoice, a message to a client, that step can read the same property. Our Notion databases page covers the relations and views most formulas sit on.

Questions people ask

What is a formula property in Notion?

A database property whose value is calculated rather than typed. It reads the other properties on the same page, and related pages through relations, and can do date math, conditions, text and list work. You can't edit its value by hand.

Can Notion formulas pull data from outside Notion?

No. A formula only sees properties in its own database and in related pages. A number from another system has to land in a property first, typed by someone or written by an integration through the Notion API.

How do I calculate a date difference in Notion?

Use dateBetween() with two dates and a unit: years, quarters, months, weeks, days, hours or minutes. It subtracts the second date from the first, so dateBetween(prop("End"), prop("Start"), "days") gives a positive number when End is later.

Did Notion change its formula syntax?

Yes. Formulas 2.0 added lists, dot notation through relations, let() and lets() for named values, and style() for colored text. Formulas written in the older syntax generally keep working, but examples from old tutorials may need rewriting.

Can Notion AI write a formula for me?

On Business and Enterprise plans, yes. It can help write a formula from a plain description, though Notion says it can't handle loop-style logic, and there's no random() function for it to reach for.

Let's talk

Tell us the one thing your team does manually that eats up time. We read every message and reply within a day.