New in Formulas 2.0

A more user-friendly editor, 3 new data types, over 30 additional functions, support for variables — and much more. There’s a lot to cover, so let’s jump in!

Notion’s new formula editing experience has been upgraded in a number of ways.

• Multiline Editing: no more one-line formulas! Create a new line with `shift` + `enter`
• Code Indentation: make your formulas more readable by indenting with `tab`
• Inline Comments: keep track of what your formula does with `/* handy comments */`
• Property Tokens: Property references like `prop("This")` are now shown like `This` in the editor.

Lists can hold items of any data type and are surrounded by square brackets. Lists are displayed as:

• Comma-separated: strings, numbers, and dates.
• Space-separated: People, booleans, and pages.

These represent Notion users, like those found in a Person property. People are displayed as full names with a photo.

These represent Notion pages, like those found in a Relation property. Pages are displayed as a rich page link with a page icon.

1. ifs
2. split
3. substring
4. lower
5. upper
6. includes
7. at
8. every
9. some
10. filter
11. match
12. find
13. findIndex
14. first
15. last
16. flat
17. let
18. lets
19. map
20. repeat
21. sort
22. reverse
23. sum
24. parseDate
25. dateRange
26. week
27. style
28. unstyle
30. name
31. email
1. concat: Now concatenates lists, use + for concatenating strings instead
2. join: Now joins items in a list, but still returns a string as per F1.0 behaviour
3. slice: Now slices lists, use substring to slice strings instead
4. start: Renamed to dateStart
5. end: Renamed to dateEnd

Six functions have been removed in favour of using their operator versions or other alternatives.

1. larger: `larger(2, 1)``2 > 1`
2. largerEq: `largerEq(2, 1)``2 >= 1`
3. smaller: `smaller(2, 1)``2 < 1`
4. smallerEq: `smallerEq(2, 1)``2 <= 1`
5. unaryPlus: `unaryPlus(true)` or `+true``toNumber(true)`
6. unaryMinus: `-+true` or `unaryMinus(+true)``-toNumber(true)`

Notion now supports variables! This is a huge step towards much more concise formulas. Formulas 2.0 introduces two types of variables: built-in and user-defined.

• current
• index

A number of the new functions allow you to reference built-in `current` and `index` variables, which return the current item in the list and its place in that list respectively.

Functions that allow for the use of `current` and `index`:

• map
• every
• some
• filter
• find
• findIndex

Variables can be created using new `let` and `lets` functions. Note that these both work in exactly the same way, apart from:

• let allows for only one variable to be created.
• lets allows for multiple variables to be created.

The majority of functions can now be written in two ways. The first we’ll refer to as the regular notation, and the new version as dot notation.

```.wp-block-code {
border: 0;
}

.wp-block-code > div {
overflow: auto;
}

.shcb-language {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
-webkit-clip-path: inset(50%);
clip-path: inset(50%);
height: 1px;
margin: -1px;
overflow: hidden;
position: absolute;
width: 1px;
word-wrap: normal;
word-break: normal;
}

.hljs {
box-sizing: border-box;
}

.hljs.shcb-code-table {
display: table;
width: 100%;
}

.hljs.shcb-code-table > .shcb-loc {
color: inherit;
display: table-row;
width: 100%;
}

.hljs.shcb-code-table .shcb-loc > span {
display: table-cell;
}

.wp-block-code code.hljs:not(.shcb-wrap-lines) {
white-space: pre;
}

.wp-block-code code.hljs.shcb-wrap-lines {
white-space: pre-wrap;
}

.hljs.shcb-line-numbers {
border-spacing: 0;
counter-reset: line;
}

.hljs.shcb-line-numbers > .shcb-loc {
counter-increment: line;
}

.hljs.shcb-line-numbers .shcb-loc > span {
}

.hljs.shcb-line-numbers .shcb-loc::before {
border-right: 1px solid #ddd;
content: counter(line);
display: table-cell;
text-align: right;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
width: 1%;
}```/* Regular Notation: All arguments are added within the () brackets */
/*      ↑...↑ First argument */

/* Dot Notation: The first argument is added before the dot */
``````

The following functions cannot be written in the dot notation.

• e
• pi
• now

Gone are the days of multiple nested `if` statements! The introduction of `ifs` allows for a much more elegant way of handling if-else statements.