How to Use Notion Formula find() to Search Within Relation Array
🔍 WiseChecker

How to Use Notion Formula find() to Search Within Relation Array

Notion formulas can manipulate data from relation and rollup properties, but searching within an array of related items requires a specific function called find(). Without this function, you cannot check whether a related page meets a condition or extract a value from a specific item inside the array. This article explains how the find() formula works with relation arrays, what parameters it needs, and how to build a working example step by step.

The find() function returns the first element in an array that satisfies a given condition. When applied to a relation property, the array contains all linked pages, and you can search for a specific value in a rollup or property of those pages. This guide focuses on the exact syntax and a practical use case so you can apply it in your own databases.

Key Takeaways: Notion find() Formula for Relation Arrays

  • find(condition, array): Returns the first element in the array that makes the condition true, or undefined if no match is found.
  • Relation property as array: When used in a formula, a relation property automatically behaves as an array of the linked pages, not a single value.
  • Rollup inside find(): You must reference a rollup property (e.g., prop("Rollup Name")) inside the condition to access data from the related pages.

ADVERTISEMENT

How Notion find() Works with Relation Arrays

The find() function is part of Notion’s formula language and is used to search through an array. Its syntax is find(condition, array). The condition is a boolean expression that tests each element of the array. The function returns the first element for which the condition evaluates to true. If no element satisfies the condition, it returns undefined.

When you have a relation property in a Notion database, that property is treated as an array of the linked pages. Each element in the array represents one linked page. To search within that array, you need to pass the relation property as the array argument. However, you cannot directly access a property of the linked page inside the condition. Instead, you must first create a rollup property that pulls the specific value from the related pages. That rollup property becomes an array of the same length, containing the extracted values.

For example, suppose you have a Tasks database with a relation to a Projects database. Each task can be linked to multiple projects. You want to check whether any of the linked projects have a status of “Active.” You would create a rollup in the Tasks database that pulls the Status property from the Projects database. Then, in the formula, you use find() to test whether any element in that rollup array equals “Active.”

The key prerequisite is that the rollup property must be set to “Show original” (not “Show unique” or “Show count”) so that it returns an array of all values, one per linked page. If the rollup is set to “Show unique,” it may deduplicate values and break the array structure.

Steps to Build a find() Formula That Searches a Relation Array

Follow these steps to create a formula that uses find() to search within a relation array. The example assumes you have a Tasks database related to a Projects database, and you want to see if any linked project has a priority of “High.”

  1. Create a relation property linking Tasks to Projects
    In your Tasks database, add a Relation property. Name it “Related Projects.” Configure it to link to the Projects database. Link a few tasks to some projects so you have data to test.
  2. Add a rollup property that pulls the target value
    Add a Rollup property to the Tasks database. Name it “Project Priority.” Set the Relation to “Related Projects.” Set the Property to “Priority” (the property in Projects that contains the priority value). Under “Calculate,” choose “Show original.” This ensures the rollup returns an array of all priority values from the linked projects.
  3. Create a formula property to use find()
    Add a Formula property to the Tasks database. Name it “Has High Priority Project.” Click the formula editor.
  4. Write the find() formula
    In the formula editor, type:
    find(prop("Project Priority") == "High", prop("Project Priority"))
    This formula checks each element in the “Project Priority” array. The condition tests whether the element equals “High.” If any element matches, find() returns that element (the string “High”). If none match, it returns undefined.
  5. Test the formula
    Click “Done” in the formula editor. The column will show “High” for tasks that have at least one linked project with priority “High.” For tasks with no high-priority projects, the cell will be blank (because undefined displays as empty).

If you want a boolean result (true/false) instead of the matching value, wrap the find() with the empty() function and negate it. For example: !empty(find(prop("Project Priority") == "High", prop("Project Priority"))). This returns true if a match exists, false otherwise.

ADVERTISEMENT

Common Mistakes When Using find() with Relation Arrays

Rollup set to “Show unique” instead of “Show original”

If the rollup property is set to “Show unique,” it may deduplicate values and return a shorter array or a single value. This breaks the find() function because the array no longer has one element per linked page. To fix this, edit the rollup property and change the Calculate option to “Show original.”

Using prop(“Relation”) directly in find()

You cannot use find(condition, prop("Related Projects")) and then try to access a property of each linked page inside the condition. The condition must work on the elements of the array passed as the second argument. If you pass the relation itself, the elements are the linked page objects, not their properties. You must first create a rollup that extracts the property you want to search.

Condition references a property that does not exist on the related database

If the rollup property pulls a property that is missing on some related pages, the array may contain undefined values. The find() function will compare those undefined values with your target value, and the condition will never be true for those elements. Ensure all related pages have the target property filled in, or handle empty values with empty() checks.

find() returns undefined and the formula shows an error

Notion formulas do not throw errors for undefined results; the cell simply appears blank. If you see a blank cell and expect a value, check that the rollup array contains the expected values. Temporarily add a formula property that just returns prop("Project Priority") to inspect the array content.

find() with Relation Array vs Other Array Functions

Item find() filter()
Return value First matching element or undefined Array of all matching elements
Use case Check if any element meets a condition Get all elements that meet a condition
Syntax find(condition, array) filter(condition, array)
Example output “High” or blank [“High”, “Medium”]
Performance Stops at first match Scans entire array

Use find() when you only need to know whether a condition is true for at least one element. Use filter() when you need to collect all matching elements. For checking existence, find() is more efficient because it stops at the first match.

Conclusion

The find() function lets you search within a relation array in Notion formulas by testing each element against a condition. You must pair it with a rollup property set to “Show original” to create an array of the values you want to search. Use the pattern find(prop("Rollup") == "Value", prop("Rollup")) to return the matching value or undefined. For a boolean result, wrap the expression with !empty(). After mastering find(), explore the filter() function to return multiple matches from a relation array.

ADVERTISEMENT