You created a formula in a Notion database that pulls data from a Relation property. When the relation is empty, the formula shows the word “Undefined” instead of a blank or a fallback value. This happens because Notion formulas treat empty relation cells as missing data rather than an empty string. This article explains exactly why the error occurs and provides the formula fix to display a blank or custom text when the relation has no linked page.
Key Takeaways: Fixing Undefined in Notion Relation Formulas
- prop(“Linked Item”).map(current.prop(“Name”)) Returns an array; an empty relation still returns an array with one element that is undefined
- if(empty(prop(“Linked Item”)), “”, prop(“Linked Item”).map(current.prop(“Name”))) Wraps the array output in an empty check to prevent undefined display
- if(empty(prop(“Linked Item”)), “No data”, prop(“Linked Item”).map(current.prop(“Name”))) Replaces undefined with custom text like “No data”
Why a Notion Relation Formula Shows Undefined
Notion formulas that read data from a Relation property use the map() function to extract values from linked pages. For example, prop("Linked Item").map(current.prop("Name")) returns an array of names from all linked pages. When the Relation property is empty — meaning no page is linked — the formula still attempts to run map() on an empty array. The result is an array containing a single element that is undefined.
Notion displays this undefined value as the literal word “Undefined” in the formula cell. This is not a bug. It is the expected behavior of the formula engine when it cannot resolve a value from an empty set. The formula does not automatically return a blank string or zero. You must explicitly handle the empty case using the empty() function combined with an if() statement.
The root cause is that map() always returns an array, even when the source property has no items. An empty relation is not the same as a null value in formula logic. The empty() function correctly detects a relation with zero linked pages and returns true. Using this check before the map() call prevents the undefined output.
Steps to Replace Undefined With a Blank or Custom Value
- Open the database where the formula shows Undefined
Go to your Notion workspace and open the database page containing the formula property. Click the database title at the top of the page to reveal the menu, then select “Open as page” if needed. - Edit the formula property
Click the “…” menu on the formula column header. Choose “Edit property” from the dropdown. The property editor panel opens on the right side of the screen. - Locate the formula that references the Relation property
In the property editor, find the formula text field. It contains the current formula that returns Undefined. The typical offending pattern isprop("Linked Item").map(current.prop("Name"))where “Linked Item” is the name of your Relation property. - Wrap the formula with an empty check
Replace the existing formula with this structure:if(empty(prop("Linked Item")), "", prop("Linked Item").map(current.prop("Name")))The
empty()function returnstruewhen the relation has zero linked pages. Theif()statement then outputs an empty string""instead of running themap()function. When the relation has at least one linked page, themap()runs normally and returns the array of names. - Use custom fallback text if needed
If you prefer text like “No linked item” instead of a completely blank cell, replace the empty string:if(empty(prop("Linked Item")), "No linked item", prop("Linked Item").map(current.prop("Name")))You can write any text inside the quotation marks. Notion will display that text in every formula cell where the relation is empty.
- Test the formula with both empty and filled relations
After saving the formula, check a row that has no linked page. The cell should show your fallback value instead of “Undefined”. Then check a row with one or more linked pages. The names should appear correctly as an array.
Handling Multiple Relation Values With the Same Fix
The fix works identically when your formula extracts multiple properties from the relation or uses nested functions. For example, if your original formula is prop("Linked Item").map(current.prop("Due Date").format("MMM D")), wrap it the same way: if(empty(prop("Linked Item")), "", prop("Linked Item").map(current.prop("Due Date").format("MMM D"))). The empty() check prevents the entire chain from executing when no pages are linked.
If Notion Still Shows Undefined After the Fix
Formula still shows Undefined on empty relation
The most common mistake is placing the empty() check inside the map() function instead of outside it. For example, prop("Linked Item").map(if(empty(current), "", current.prop("Name"))) does not fix the issue because map() still runs on an empty array and returns an array with an undefined element. The empty() check must be on the relation property itself, before the .map() call.
Formula returns an empty array [] instead of blank
If you use if(empty(prop("Linked Item")), [], prop("Linked Item").map(current.prop("Name"))), the cell will show [] when the relation is empty. Use an empty string "" inside the if() statement to display a completely blank cell. If you want the cell to look empty but still contain an array for downstream formulas, use [] intentionally.
Formula works in one database but not another
Check that the Relation property name in the formula matches exactly. Property names are case-sensitive. A typo like prop("linked item") instead of prop("Linked Item") causes the formula to return Undefined for all rows, not just empty ones. Open the property editor and copy the exact name from the property list.
Notion Formula Behavior: Empty Relation vs Rollup vs Lookup
| Feature | Empty Relation Output | Fix Method |
|---|---|---|
| Relation with map() | Undefined | if(empty(prop(…)), “”, prop(…).map(…)) |
| Rollup property | Blank (no value) | No fix needed — Rollup already returns blank for empty relations |
| Lookup with formula | Undefined | Same wrap method as Relation with map() |
A Rollup property automatically displays a blank cell when the source relation is empty. You do not need the empty() fix for Rollup. A Lookup property that uses a formula to extract data from a linked database behaves the same as a Relation formula and requires the same fix.
Now you can fix any Notion formula that shows Undefined for an empty relation. Apply the if(empty(prop(...)), "", ...) pattern to every formula that reads data from a relation or lookup. For formulas that pull multiple values, consider using the join() function inside the map() to return a single string instead of an array. For example, if(empty(prop("Linked Item")), "", prop("Linked Item").map(current.prop("Name")).join(", ")) shows a comma-separated list and keeps the cell blank when the relation is empty.