This is your sign to try let() and lets()
Two notable functions within Notion's formula ecosystem are let() and lets(). These functions enable users to simplify their calculations and make complex formulas more manageable. In this blog post, we will explore the structure of both functions, break down how they work, and provide examples to illustrate their usage.
For this guide, I referenced the Notion Formula documentation and added my own examples and explanations.
Summary
Name | Syntax | Description | Example |
let() | let(variable, value, expression) | Designed to define a temporary variable within a formula. | let(price, 150, price * 1.1) → this will output 165 (which is basically 150 x 1.1) |
lets() | lets(variable1, value1, variable2, value2, ..., expression) | Designed to define multiple temporary variables within a formula. | lets(test1, 85, test2, 90, test3, 95, (test1 + test2 + test3) / 3) → this will output 90. |
let() Formula
How let() works
The let() function is designed to define a temporary variable within a formula. Its syntax allows you to create a single variable that can be used in subsequent calculations or expressions.
Here's how you would write the formula statement in Notion:
let(variable, value, expression)
Notion Formula
복사
Breaking it down
•
variable: The name of the variable you're defining. (Do not enclose this in a quotation mark).
•
value: The value you want to assign to that variable.
•
expression: The formula or calculation that utilizes the defined variable.
Example of let()
formula
Search
lets() Formula
How lets() works
The lets() function, on the other hand, is used for defining multiple variables at once. This is particularly useful for complex formulas where you need to refer to several intermediate values.
The general structure of lets() is:
lets(
variable1, value1,
variable2, value2,
...,
variablen, valuen,
...,
expression
)
Notion Formula
복사
Breaking it down
•
variable1, variable2, ...: Names of the variables you are defining. (Do not enclose this in a quotation mark).
•
value1, value2, ...: The corresponding values assigned to those variables.
•
expression: The final formula or calculation that uses the defined variables.
Example of formula
formula
Search
Conclusion
The let() and lets() functions make formulas cleaner and easier to understand. If you have a repetitive calculation or value in the formula, be sure to use these functions.
Thank you for reading this tutorial! If you found it helpful, be sure to check out shop for my beautiful templates, which I am confident enough to say are a game-changer Subscribe to my newsletter and feel free to follow me on my social media for updates!
Happy Notion(ing)!
links
Search