You wrote a Notion formula that returns a value in one display mode, but shows undefined when you switch to another mode. This problem typically occurs because different display modes — such as Table, Board, or Gallery — handle empty or missing formula results differently. Notion formulas that depend on other database properties may return undefined when those properties are not visible or not loaded in the current view. This article explains why the undefined output appears inconsistently and how to fix your formula so it returns a stable result across all display modes.
The root cause is that Notion evaluates formulas based on the properties that are currently rendered in the view. In a Table view, all properties are loaded, so the formula has full access to data. In a Gallery or Board view, some properties may be hidden or not fetched until the card is opened. When a formula references a property that is not loaded, Notion returns undefined instead of the expected value. You will learn how to rewrite your formula to handle missing data and ensure consistent output.
After applying the fixes in this article, your formula will return a stable value — such as an empty string, a default number, or a fallback text — regardless of the display mode. You will also learn how to test formulas in different views before finalizing them. This saves time and prevents data display errors in shared workspaces.
Key Takeaways: Why Notion Formula Undefined Output Differs Between Display Modes
- Formula property reference to a hidden column: When the referenced property is not loaded in the current view, the formula returns
undefined. - Using the
empty()function in your formula: Wraps each property reference withempty()to return a fallback value when the property is missing. - Testing in Table view then switching to Board or Gallery: Confirms the formula output remains stable after switching display modes.
Why Display Modes Change Formula Output
Notion databases support multiple display modes: Table, Board, Gallery, List, Calendar, and Timeline. Each mode renders properties differently. In Table view, every property column is visible and loaded when the page opens. In Board view, only the card title and a few preview properties are shown; the rest are loaded only when you open the card detail panel. Gallery view behaves similarly — it shows an image or cover and a few text fields, but most property values are not fetched until the card is expanded.
When a formula references a property that is not loaded in the current view, Notion cannot evaluate that reference. Instead of returning an empty string or zero, Notion returns the literal value undefined. This is a behavior specific to formula properties — it does not happen with regular text or number properties because they are displayed as blank when not loaded.
How Notion Evaluates Formula Dependencies
Notion formulas are computed on the server side, but the client (your browser or app) requests the values based on what is visible. If a property is not in the viewport or not part of the current display mode, the client may not request its value. The server then returns undefined for that property, which propagates into your formula result. This is not a bug — it is a performance optimization that reduces data transfer for large databases.
Which Display Modes Are Most Affected
Board and Gallery views are the most common triggers for this issue. Calendar and Timeline views also hide many properties by default. List view shows only the title and a small preview, so it can also produce undefined for formulas that reference non-visible properties. Table view is the only mode that loads all properties, making it the safest environment for testing formulas.
Steps to Rewrite a Formula That Returns Undefined in Board or Gallery View
Follow these steps to modify your formula so it returns a stable value regardless of the display mode. The key is to check each referenced property for undefined and provide a fallback.
- Identify which properties the formula references
Open the database in Table view. Click the formula property header and select Edit formula. Look at every property name used in the formula. Write them down. For example, if your formula isprop("Price") prop("Quantity"), the referenced properties are Price and Quantity. - Wrap each property reference with the empty() function
Use theempty()function to check if the property value is missing. The syntax isif(empty(prop("Price")), 0, prop("Price")). This returns 0 if Price isundefinedor empty, otherwise it returns the actual Price value. Replace every directprop()call with this pattern. - Apply the fallback to your entire formula
Rewrite the full formula using the wrapped references. For the Price times Quantity example, the new formula becomes:if(empty(prop("Price")), 0, prop("Price")) if(empty(prop("Quantity")), 0, prop("Quantity")). This ensures that if either property is not loaded, the formula uses 0 instead ofundefined. - Test the formula in Table view first
Click Save in the formula editor. Verify that the formula returns the expected numeric result in Table view. If you see any errors, double-check the property names and the parentheses in yourif(empty(...))calls. - Switch to Board or Gallery view to confirm stability
Change the database view to Board or Gallery. Look at the formula property on several cards. The output should now show the fallback value (0 in this example) instead ofundefined. If you still seeundefined, the formula may reference a property that is not included in the card preview at all — add that property to the card preview settings.
Alternative: Use the coalesce() Function for Text Formulas
If your formula returns text, you can use the coalesce() function to replace undefined with a default string. For example, coalesce(prop("Name"), "No name") returns “No name” when Name is undefined or empty. This is shorter than using if(empty(...)) for each text property.
If Notion Still Shows Undefined After Rewriting the Formula
Sometimes the fix above is not enough because the referenced property is completely excluded from the display mode. Here are additional steps to resolve the issue.
The Referenced Property Is Not in the Card Preview
In Board view, each card shows only the properties you add to the card preview. If your formula references a property that is not in the preview, that property is never loaded, and empty() will always return true. To fix this, open the Board view, click the view menu, select Layout, then add the missing property to the Card Preview section. The formula will then have access to the property value.
Formula Contains a Nested Function That Does Not Handle Undefined
Some Notion formula functions, like dateAdd() or formatDate(), throw an error if their input is undefined. Even if you wrap the property with empty(), the error can still appear if the fallback value is not compatible with the function. For example, dateAdd(if(empty(prop("Date")), now(), prop("Date")), 1, "days") uses now() as a fallback instead of an empty string. Check that every fallback value matches the data type expected by the function.
Formula Property Is Not Refreshed After Changing Views
Notion caches formula results for performance. If you switch from Table to Board view and the formula still shows undefined, force a refresh by clicking the formula property header and selecting Recalculate. Alternatively, close and reopen the database page. This clears the cached results and re-evaluates the formula with the current view’s data.
Notion Formula Output Stability: Table vs Board vs Gallery
| Display Mode | Properties Loaded by Default | Formula Output Without Fallback |
|---|---|---|
| Table | All properties in columns | Correct value |
| Board | Only properties in card preview | Undefined for non-preview properties |
| Gallery | Only title and cover | Undefined for most properties |
| List | Title and one preview line | Undefined for non-preview properties |
| Calendar | Date property and title | Undefined for other properties |
| Timeline | Date range and title | Undefined for other properties |
This table shows that Table view is the only mode that loads all properties. Every other mode limits which properties are fetched, causing formulas that reference non-loaded properties to return undefined. Using fallback functions like empty() or coalesce() ensures your formula works in any view.
You now understand why Notion formula output changes between display modes and how to prevent undefined results. Start by editing your formula to wrap each referenced property with empty() and provide a default value. Test the formula in Table view first, then switch to Board or Gallery view to confirm stability. For complex formulas, add missing properties to the card preview in Board view. As an advanced tip, use the coalesce() function for text properties to reduce formula length and improve readability.