2 min readfrom Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

Filter (Search (Wildcard match) )

Our take

To effectively filter a table based on job locations that start with specific prefixes like "US-NY," "US-ME," and "US-VT," while accommodating a dynamic lookup table, consider refining your approach. Use the FILTER function alongside BYROW and SEARCH to identify matches that include those prefixes within a more complex string. By structuring your criteria in a lookup table, you can simplify adjustments and enhance readability.

I want to Filter a table where Job Location starts with either "US-NY, US-ME, US-VT" - although I have 8 categories with up to 13 locations in one of the categories.

The "problem" (as I can see it) is that the filter criteria is the full title, and I only want to partial match to anything in the list.

I actually have it working if I statically define in the formula all of the criteria it can be: {"US-NY", "US-ME", "US-VT"}. However when I try to move those values into a table so I can build out the criteria dynamically and make it more readable, I can't seem to get it to work.

Here is what I have: FILTER(sheet!A:L, BYROW(SEARCH(Table1[NEUS], sheet!J:J, ISNUMBER))

So I want to filter columns A:L, but to determine which rows to include I want to look up each row to see which column it will match (one of the 8 categories mentioned above).

However, column J will look like US-TX-Beaumont, US-LA-Monroe, or US-ME-Brownville etc. So the criteria will have MORE info than the lookup table, and so I effectively want the lookup table to have a wildcard on it, and any full location will match to one of those categories.

Right now I'm just trying to get it to work to match a single column and then I was probably going to use a SWITCH statement, however if there is a more efficient way to figure out which column it's in rather than having 8 lookups then even better.

Lookup Table:

NEUS US N US S
US-NY US-IL US-TX
US-ME US-IA US-LA

Data:

First Last Location
Kyle Smith US-TX-Beaumont
Mike Johnson US-ME-Brownville

Disclaimer: This is a simplified version of the data vs lookup table and it is not strictly determined by the first 5 characters of the string.

And on separate sheets I want one that filters everything for NEUS, different sheet for US N, and different sheet for US S.

Let me know if anything I've described is confusing.

submitted by /u/allsix
[link] [comments]

Read on the original site

Open the publisher's page for the full experience

View original article

Related Articles

Tagged with