HomeGoogle DocsSpreadsheetFilter Based on a List in Another Tab in Google Sheets

Filter Based on a List in Another Tab in Google Sheets

Published on

Here is a cool Filter function tip. You can learn now how to filter based on a list in another tab in Google Sheets.

You can make your Filter formula clean and readable by following my below tips and can learn some advanced Filter function use.

Do you know how to filter a dataset using criteria from a column range?

I mean, I want to use criteria in a Filter formula from a column range which can be from the same sheet tab or another sheet tab.

Please see the image below. The criteria list is in column E and the range to filter is the columns A and B.

filter using a list as criteria

It’s not easy to enter all the criteria within the formula because there are a total of 10 criteria aka conditions to filter. Also, it’s not suggestible as it can make your formula cluttered.

If you have 3-4 criteria, you can include it in the function very easily. I mean you can hardcode it as below.

=filter(A1:B,regexmatch(A1:A,"plum|cherry|papaya"))

But when it is very large, the better solution is to enter the criteria in a column and refer that column as criteria. Is this possible?

Yes! With the help of the REGEXMATCH function, we can do that easily.

Similar: Regexmatch in Filter Criteria in Google Sheets [Examples]

How to Filter Based on a List in Another Tab in Google Sheets

Master Filter Formula:

=filter(A1:B,regexmatch(A1:A,join("|",E1:E10)))

In my example above, the dataset (A1:B) and the criteria list (E1:E10) are on the same sheet. If the criteria list is in a different tab just include the Tab name with the range as usual.

Example:

Sheet2!E1:E10

Here in our Master Filter Formula, the range is A1:B and the criteria is the Regexmatch formula.

What does this Regexmatch formula do?

To understand that see a simple example. Suppose the value in cell A1 is “Inspired”. The following REGEXMATCH formula would return TRUE if any of the words “Info” or “Inspired” is present in cell A1.

=regexmatch(A1,"Info|Inspired")

In our main example above (mater filter formula), the criteria list is in the range E1:E10. The Join function joins all the criteria together and that separated by a pipe “|” symbol.

=join("|",E1:E10)

Output:

"apple|apricot|banana|blackberry|blackcurrant|blueberry|cherry|coconut|fig|grape"

The REGEXMATCH returns TRUE for all the matches and FALSE for the mismatch.

The Filter filters the TRUE values. That means all the values in the range A1:B filtered wherever it has a match in E1:E10.

Additional Tips

There is one unaddressed problem with the above formula. It’s the exact match.

For example, the Regexmatch formula used above can’t differentiate the word “pineapple” and “apple”. It considers both the same.

If you want an exact filter with several criteria as above, just change the formula as below.

=filter(A1:B,regexmatch(A1:A,join("|",("^"&E1:E10&"$"))))

Here what I have done is placed a Caret ^ symbol at the beginning of each criterion and a Dollar $ symbol at the end. It’s like;

^apple$|^cherry$

That’s all. Hope you have enjoyed this tutorial. Thanks for the stay.

Related:

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Appointment Schedule Template in Google Sheets

An appointment schedule template in Google Sheets can assist you in efficiently managing your...

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Running Total By Month in Excel

This tutorial demonstrates how to calculate the running total by month in a range...

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

More like this

Appointment Schedule Template in Google Sheets

An appointment schedule template in Google Sheets can assist you in efficiently managing your...

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

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.