Use One FILTER Function as a Condition in Another FILTER in Google Sheets

Published on

Did you know you can use one FILTER function as the condition inside another FILTER in Google Sheets? It’s a neat trick — especially useful when you’re working with two connected tables or dependent datasets.

If the inner FILTER returns just one value, everything works smoothly. But if it returns multiple values, things get a little more interesting — and you’ll need a smarter formula to make it work.

Let’s break it down with a real example, covering both the easy case and the one where most people get stuck.

The Setup — Two Tables

Imagine you’re working with two related tables:

Table 1: Item & Quantity (A1:B)

ItemQuantity
Raspberries10
Blackberries10
Pomegranate10
Apple20
Pineapple20
Banana25
Watermelon10
Raspberries5
Apple5
Banana5

Table 2: Item & Unit Price (D1:E)

ItemUnit Price
Raspberries3.00
Blackberries3.00
Pomegranate2.50
Apple1.50
Pineapple1.25
Banana0.75
Watermelon0.50

Your goal is to filter Table 1 based on a condition applied to Table 2 — for example, show only the items whose unit price is less than 2.

Case 1: When the Inner FILTER Returns One Item

Let’s start with the simpler scenario. Suppose you want to filter Table 1 to include only rows where the item’s unit price is less than 0.75.

Step 1: Use FILTER on Table 2

=FILTER(D2:D, E2:E < 0.75, E2:E <> "")

This returns: "Watermelon"

Step 2: Plug That into Another FILTER on Table 1

=FILTER(A2:B, A2:A = FILTER(D2:D, E2:E < 0.75, E2:E <> ""))

This works perfectly because the inner FILTER only returns one value — and A2:A = "Watermelon" is a valid condition across the range.

Google Sheets example showing a single-value FILTER used as the condition in another FILTER function

Case 2: When the Inner FILTER Returns Multiple Items

Now increase the threshold to less than 2, which returns multiple matches from Table 2.

Step 1: Update the FILTER on Table 2

=FILTER(D2:D, E2:E < 2, E2:E <> "")

This returns: "Apple", "Pineapple", "Banana", and "Watermelon"

Step 2: Try That in Another FILTER (Will Fail)

=FILTER(A2:B, A2:A = FILTER(D2:D, E2:E < 2, E2:E <> ""))

This formula fails with a #N/A error because you’re trying to compare a column (A2:A) with an array of multiple values — something FILTER doesn’t handle natively this way.

The Fix: Use XMATCH to Handle Multiple Values

Here’s the clean solution: use XMATCH to check whether each item from Table 1 appears in the filtered result from Table 2.

Working Formula:

=FILTER(A2:B, XMATCH(A2:A, FILTER(D2:D, E2:E < 2, E2:E <> "")))
Example of using one filter as the condition in another filter in Google Sheets when the inner FILTER returns multiple values

What This Formula Does:

  • FILTER(D2:D, E2:E < 2, E2:E <> "") pulls the items with a unit price under 2.
  • XMATCH(A2:A, ...) checks whether each item in Table 1 appears in that list.
  • If there’s a match, XMATCH returns a number; otherwise, it returns #N/A.
  • FILTER keeps the rows where XMATCH returned a match (i.e., a number).

That’s how you can use one filter as the condition in another filter in Google Sheets, even when the inner filter gives multiple results.

Final Thoughts

When working with related tables — like a product list and its pricing — using one FILTER function as the condition inside another lets you build smart, responsive filters in Google Sheets.

Key Takeaways:

  • For single-result filters, plug them directly into the outer condition.
  • For multi-result filters, use XMATCH or REGEXMATCH to create a match-checking condition.
  • This method works great for auto-updating lists, dashboards, and anything with dynamic filtering.

It’s a small trick — but it unlocks powerful logic, especially for more complex Google Sheets workflows.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Top Discussions

More like this

Pivot Table Formatting, Output & Special Behavior in Google Sheets

Pivot Tables in Google Sheets are powerful—but they can get tricky once you move...

Pivot Table Calculations & Advanced Metrics in Google Sheets

When it comes to built-in tools for data analysis and visualization in Google Sheets,...

Google Sheets Pivot Table Tutorial: Basics, Setup, and Date Grouping

The easiest way to summarize, analyze, and report data in Google Sheets is by...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.