When writing formulas in Notion databases, you often need to refer to other columns in the same row. The prop function is the standard way to pull values from a specific property. However, many users encounter performance issues or formula errors when they repeatedly call prop for the same property inside a complex formula. This article explains what a reference variable is, why it can improve formula performance and readability, and when you should use a variable instead of calling prop multiple times.
A reference variable stores a property value once and reuses it throughout the formula. This reduces the number of property lookups and makes the formula easier to debug. You will learn the syntax for creating variables, the exact scenarios where variables outperform repeated prop calls, and the limitations you must watch for.
Key Takeaways: Using Reference Variables in Notion Formulas
- let() function: Declares a variable and assigns it a value, which you can then reuse by name anywhere in the formula body.
- Single prop() call vs multiple calls: Using a variable with
let()callsprop()once, improving performance for formulas that reference the same property more than twice. - Readability and debugging: Variables let you name intermediate values (like
dueDateorstatus) so the formula is self-documenting and easier to troubleshoot.
What a Reference Variable Is in Notion Formulas
In Notion, a formula is a single expression that can include functions, operators, and references to other database properties. When you write prop("Due Date"), the formula engine looks up the value of the Due Date property for the current row. If you need that value in three different places, you must write prop("Due Date") three times. Each call triggers a property lookup, which can slow down formulas on large databases with hundreds or thousands of rows.
A reference variable lets you store the result of a prop() call in a named container using the let() function. The syntax is:
let(variableName, prop("Property Name"), expression that uses variableName)
The let() function takes three arguments: the variable name (no quotes), the value to assign, and the final expression where the variable is used. The variable name must start with a letter and can contain letters, numbers, and underscores. The variable is only available inside the let() call — it does not persist outside the formula.
How let() Differs from prop()
Calling prop("Name") repeatedly inside a formula causes the engine to fetch the property value each time. With let(), the property is fetched once and stored in memory for the duration of the formula evaluation. This difference matters when the formula references the same property three or more times. For formulas that reference a property only once, using let() adds unnecessary complexity with no performance benefit.
When to Use a Reference Variable
Use a reference variable in these specific situations:
- You reference the same property three or more times
If your formula usesprop("Status")in multiple conditions, store it once withlet(). Example: a formula that checks if Status is “Done”, then formats the date, and also counts completed tasks. Threeprop()calls become one. - The property name is long or contains special characters
Writingprop("Project Manager Email Address")four times is error-prone. A variable likepmEmailreduces typos and makes the formula shorter. - You need to perform a calculation on a property value before reusing it
If you must convert a date to a number or extract a substring, store the transformed value in a variable. For instance,let(dayNum, day(prop("Start Date")), ...)lets you reusedayNumwithout recalculating. - You are building a nested conditional or switch statement
Complex logic withif()orifs()becomes readable when intermediate results have descriptive names likeisOverdueorpriorityScore.
Steps to Replace Repeated prop() Calls with a Variable
Follow this process to refactor an existing formula that uses prop() multiple times.
- Identify the property used more than twice
Open your Notion database and click the formula property cell. Review the formula and count how many times eachprop("PropertyName")appears. Any property appearing three or more times is a candidate for a variable. - Wrap the entire existing expression with let()
Placelet(variableName, prop("PropertyName"),before the existing formula, and close with)at the end. For example, if your formula isprop("Price") 1.1 + prop("Price") 0.05, change it tolet(p, prop("Price"), p 1.1 + p 0.05). - Replace every occurrence of prop(“PropertyName”) with the variable name
Inside the expression after the comma, replace eachprop("Price")withp. Do not include quotes around the variable name. - Test the formula
Click outside the formula editor or press Enter. Verify the result is the same as before. If you see an error, check that the variable name is spelled consistently and that thelet()parentheses are balanced. - Add more variables for other repeated properties
You can nest multiplelet()calls to store several values. Example:let(p, prop("Price"), let(q, prop("Quantity"), p q)). Each variable is available only inside its ownlet()scope.
Common Mistakes When Using Reference Variables
Even experienced Notion users make errors with variables. Here are the most frequent problems and how to avoid them.
Variable name conflicts with a property name
If you name a variable Status and your database also has a property called Status, the formula may become ambiguous. Always use a distinct name, such as taskStatus or s. Notion does not prevent you from using the same name, but it can cause unexpected behavior.
Forgetting to close the let() parentheses
The let() function requires three arguments and a closing parenthesis. A common mistake is to put the closing parenthesis in the wrong place, which truncates the formula. Count parentheses: every opening ( must have a matching ). Use a code editor or Notion’s built-in syntax highlighting to spot mismatches.
Using a variable outside its scope
A variable defined inside a let() is only available in the expression that follows. If you try to reference p outside the let() block, the formula returns an error. Nest let() calls to pass values to deeper levels, or define the variable at the outermost level if you need it everywhere.
Using let() when prop() is called only once
Adding a variable for a property used only once adds complexity with no performance gain. The formula becomes harder to read and debug. Reserve variables for properties referenced two or more times.
When prop() Is Called Once vs When to Use a Variable
| Scenario | Repeated prop() calls | Using let() variable |
|---|---|---|
| Formula references same property 1 time | Simple, readable, no performance issue | Unnecessary complexity, no benefit |
| Formula references same property 2 times | Acceptable, but variable may improve readability | Optional — use if property name is long |
| Formula references same property 3 or more times | Redundant lookups, slower on large databases | Recommended — one lookup, faster execution |
| Property name is long (over 20 characters) | Error-prone typing, hard to read | Shorter variable name reduces mistakes |
| Intermediate calculation needed | Must repeat the calculation each time | Store result once, reuse without recalc |
This table shows that the threshold for using a variable is three or more references to the same property. For two references, the decision depends on readability. For one reference, avoid variables.
When Not to Use a Reference Variable
Variables are not always the right choice. Avoid them in these cases:
- Formula is very short (one or two property references). Adding a variable makes the formula longer without improving performance.
- You need to reference the property only once inside a simple calculation. Example:
prop("Price") 1.1is better thanlet(p, prop("Price"), p 1.1). - You are using a property inside a rollup or lookup formula. Rollups and lookups already cache values differently. Variables inside those formulas can cause confusion because the scope of
let()is limited to the formula cell itself. - You are sharing the database with others who are not comfortable with advanced formulas. Variables add complexity. If your team needs to edit formulas, simpler
prop()calls may be easier for them to understand.
Conclusion
Using a reference variable with the let() function in Notion formulas reduces property lookups and improves both performance and readability when the same property is referenced three or more times. You can store a property value once, give it a descriptive name, and reuse it throughout the formula without repeating prop() calls. For formulas with one or two references to the same property, stick with direct prop() calls to keep the formula simple. Start by auditing your most complex formulas — especially those with nested if() or ifs() statements — and refactor them with let() variables. A practical next step is to test the performance difference by duplicating a database with 500 rows and comparing load times before and after the refactor.