transcript

excelisfun - Excel FILTER based on list, not individual values? Easy! Excel Magic Trick 1696.

Thumbnail of the video “excelisfun - Excel FILTER based on list, not individual values? Easy! Excel Magic Trick 1696.”
Download Markdown
Community upload. AI output has not been independently verified.

Introduction

What do we do if we want to filter a table based on a bunch of conditions and we want that filter data set to appear off to the side? We don't want to apply each condition individually. We want an easier formula.

XMATCH with function argument array operation to compare two lists

Well, here's the easier formula. Anytime you're comparing one list against another list and you're using an Excel worksheet formula, the function to use is XMATCH. Now, the lookup value: we need to look up each individual value and see if it's in this list. But here's the thing. If we're going to filter this table, I need an array of TRUEs and FALSEs for every row in the table. So in lookup_value, instead of giving it one lookup value, I'm going to give it the whole column.

Now, this is an Excel table, so I hover my cursor at the top, and when I see my black downward-pointing arrow, I click. That puts in the name of the Excel table, ET, and the field name in square brackets, comma. Then for lookup_array, I highlight Expense Category. The default for XMATCH is to do an exact match lookup, which is what we want, so we don't need any of the other arguments. I close parentheses.

This isn't the formula yet, but when I hit Enter, let's see what it gives us. It gives us N/As at the top because that expense category is not in this list. That one's not in this list. But if we scroll down, seven, one, two, one gets a six, because when it looked up that value, it said where is it? It's the sixth value in this list. That means the N/As indicate that we do not want those rows. But when we see a number, we want to keep that row.

ISNUMBER to get TRUE and FALSE values for FILTER include argument

Now, in order to use the FILTER function, I need a FALSE there and a TRUE there. That's easy enough. We come back to the top cell where the formula lives, hit F2, and ask of that resultant array: are you a number? Using the ISNUMBER function, when I close parentheses and hit Enter, now I have exactly what I want: a bunch of FALSEs, meaning we don't want those rows, and there's a TRUE, which means I need that record.

FILTER array function (lookup function too)!!!

We come to the top cell, F2, and we can use that array of TRUEs and FALSEs in the FILTER function. In the array argument, we put the full table. I want the whole table, so I come to the upper left, and when I see that diagonal black arrow, I click to highlight the entire Excel table. There it is: ET for expense table, comma, include. We already have the TRUEs and FALSEs, so that is our formula. Close parentheses, and when I hit Enter, I have filtered all the records where the expense categories are from our list.

This is the formula we used to have to use before the FILTER function, and it's a big old array formula. This is in the downloadable workbook, so if you want to check it out, you can look at it here.

When using the FILTER function, instead of individually putting all the conditions in, we recognize this as comparing two lists, and that makes it easy. We use XMATCH and ISNUMBER inside a FILTER.

Formulas to use before FILTER function

If you like that video, be sure to click that thumbs up, leave a comment, and subscribe, because there's always lots more videos to come from excelisfun. If you want to check out some other cool videos about FILTER, here are the links.

Summary, Closing and Video Links