How to Create and Use Formulas in Notion Documents

Notion formulas allow you to perform calculations and operations on database properties to generate custom outputs. Here is a step-by-step guide on how to create and use formulas in Notion:

Adding a Formula Property

  • Click the menu (•••) on your Notion database and select Properties
  • Click + Add a property and select Formula
  • Give your formula property a name
  • Click Edit property to open the formula editor

Formula Syntax

Notion formulas use a syntax similar to JavaScript:

  • Functions – Predefined operations like add(), formatDate(), etc
  • Inputs – Values passed to the function like database properties
  • Outputs – The result of the formula

Here is the basic syntax:

functionName(input1, input2, ...)

Some examples:

  • add(1, 2) -> Returns 3
  • formatDate(now(), "MMM Do YYYY") -> Returns current date string

Writing Your First Formula

Let’s write a formula to concatenate first and last name properties:

  • Add Text properties called “First Name” and “Last Name”
  • Add a Formula property
  • Name it “Full Name”
  • Write this formula:
concat(prop("First Name"), " ", prop("Last Name"))
  • The formula combines the two text properties, adding a space between them

Common Functions

Here are some of the most useful Notion formula functions:

Date Functions

  • now() – Current date/time
  • dateBetween() – Checks if date is between two other dates
  • startOfWeek() – Gets start of week for a date
  • formatDate() – Formats date to text

Math Functions

  • add(), subtract(), multiply(), divide() – Basic math
  • round(), ceil(), floor() – Rounding
  • mod() – Modulo/remainder
  • max(), min() – Maximum and minimum values

Text Functions

  • concat() – Combine text
  • length() – Get text length
  • replace() – Find and replace text
  • slice() – Extract part of text

Logical Functions

  • and(), or(), not() – Boolean logic
  • if() – Conditional expression
  • contains() – Check if text contains substring

Referencing Properties

Use the prop() function to reference a database property in your formula.

For example:

prop("First Name")
prop("Date of Birth") 
prop("Project Status")

You can chain together prop() functions to build complex formulas.

Updating Existing Formulas

If you make changes to your database structure, you may need to update existing formulas.

Some things that could require a formula update:

  • Renaming or deleting a referenced property
  • Changing a property’s type
  • Reorganizing your database

Carefully review all formulas that reference changed properties.

Tips for Effective Formulas

Here are some tips for creating useful Notion formulas:

  • Start simple – Build up complex formulas gradually
  • Use descriptive names – Helps you and others understand the formula’s purpose
  • Check for errors – Fix issues flagged by the formula editor
  • Reference cleanly – Use prop() instead of hardcoded property names
  • Document formulas – Add comments explaining parts of complex formulas

With these basics, you can begin enhancing your Notion databases with custom formulas!