# Formulas

## In a Notion database, you can add a formula property that lets you run all kinds of calculations and functions based on other properties. You can use formulas to manipulate existing data and arrive at many other helpful values 🔮

The hardest thing about writing formulas is understanding all the terminology! Here are the most common words you'll see when using formulas in Notion and what they mean:

**Function:**A relation from a set of inputs to a set of possible outputs where each input is related to exactly one output.**Syntax:**Refers to the order of letters and terms in your formula to return the right value.**Argument:**Refers to any input in a function, like a property.**String:**A value type, most often referring to text (i.e. a string of letters next to each other). Strings are always wrapped in quotation marks in formulas.Strings are unique from other value types, such as numbers or dates.

A substring refers to a segment of a larger string. "No" is a substring of "Notion".

**Boolean:**A boolean is either true or false.**Concatenate:**Combines two strings together. Example:`concat("add", "text")`

would yield`"addtext"`

.

### Terminology in action

Here's an example to tie all of the above together: `concat("add", "text")`

`concat`

is the**function**. It applies a certain calculation or action to the inputs contained in its parentheses.`"add"`

and`"text"`

are**arguments**in that function. Each argument is text (otherwise known as a**string**).

Functions can use a variety of different arguments, such as checkboxes (also known as **booleans**), numbers or dates.

Function **syntax** requires strings to be wrapped in quotes and its arguments to be contained within parentheses.

First, in your database, add a new property, give it a name and choose

`Formula`

from the`Property type`

menu.To tell a formula to do something with a property, type a function that will use that property.

Properties operate a lot like variables in formulas. Use the names you've given them.

You can type functions just the way you would into a digital calculator (remember those?). Mind your parentheses and quotation marks around your properties!

**Tip: **Writing a complex formula? Do it in a Notion page instead of in the formula property pop-up!

Create a code block (`/code`

) and set the language to Javascript. This will highlight your formula syntax and make it easier to catch errors.

Whenever you edit a formula property, the formula window pops up. Its left sidebar menu has several sections:

`Properties`

: Lists all the properties being used in your database. Clicking on any of these inserts them into your formula with proper formatting.`Constants`

: Common constants like pi. Click on any of them to add them into your formula.`Operators`

: Simple calculations you can run. The icons to their left show you which types of properties they work with. For instance, subtraction and addition work on number properties.`Functions`

: More complex, pre-defined formulas you can run in Notion. The icons to their left also show you what types of properties they work with, too.Start typing any of these in the text box at the top of the window to search for what you need.

You can also scroll up and down with your arrow keys.

**Tip:** Hover over any of the terms in the sidebar for a full definition of how they work and an example of how they can be used.