These Microsoft Excel advanced filter examples take you beyond the basic steps. See how to find top records, filter for blank cells, find records in a date range, and more examples of complex criteria. There are written steps, videos, and a sample file to download.
Author: Debra Dalgleish
This video shows the steps for setting up a criteria range, and running an Advanced Filter. The examples below show how to set up more complicated criteria, such as finding rows with blank cells.
For the written steps on setting up a basic Excel Advanced Filter, go to the Advanced Filter Introduction page.
The examples in this section show how to set up criteria ranges for an Excel Advanced Filter.
The criteria range for an Excel advanced filter, is a group of cells on a worksheet, where you set the rules for filtering the data. The criteria range must have a specific setup, with heading cells and criteria cells.
The criteria range must include the following cells:
There are two types of criteria, and a different heading cell is required for each type:
Below the heading row, at least one row with criteria is required.
In the criteria cells, you can enter the following:
Here is a simple criteria range example:
There are many more criteria range examples in the sections below, that show how, and where, to enter the criteria that you need.
The examples on this page show the criteria range near the data, but that isn't required.
For example, the criteria range can be located:
Many beginner tutorials that I've seen rcommend putting the criteria range above the data that will be filtered.
That location is NOT required, but it does have the following advantage:
Note: This setup requires extra room at the top of the worksheet, and works best for a small criteria range.
If the criteria range is set up in columns to the left or right of the data, and in some of the same rows there is the following disadvantage:
Note: The hidden criteria rows will still be applied to the advanced filter. You just won't be able to see the criteria rules in those cells.
Usually, I put the Advanced Filter criteria range to the right of the source data, with one or more blank columns between them. That way, I don't need to leave space at the top of the worksheet, which is usally "prime real estate".
The examples on this page show the criteria range to the right of the data, but you can choose whatever location you prefer.
If one or more criteria are in the same row of the criteria range, the Advanced Filter treats those criteria as if they are inside an AND function.
For example, in the screen shot below, there are 3 criteria rules in the same row. As a result, the Advanced filter uses AND logic:
If there are criteria on multiple rows, the Advanced Filter treats those criteria as if they are inside an OR function.
In this example, there are 3 rows with criteria rules, with one criterion in each row. As a result, the Advanced filter uses OR logic:
Note: The empty cells mean, "no criteria for this data"
By using multiple rows, you can combine the AND and OR operators, like the criteria rules in this example:
When typing criteria for a filter, you can include wildcard characters, to make the criteria rule more flexible. There are three Excel wildcard characters shown in the examples below
-- The * Wildcard (asterisk)
-- The ? wildcard (question mark)
-- The ~ wildcard (tilde)
NOTE: Because Excel interprets text criteria as "begins with", you don't need to use the * or ? wildcard characters at the end of the string
The asterisk (*) wildcard character represents any number of characters in that position, including zero characters.
NOTE: Upper and Lower case letters are treated equally - the filter is not case sensitive.
The question mark (?) wildcard character represents one characters in that position.
In this example any product name in the data set that
will pass through the Excel advanced filter.
Only Coke and Cake are in the filtered data results shown below.
The tilde (~) wildcard character lets you search for characters that are used as wildcards.
For example, to find only the customer name that begins with Good*Eats, use a tilde character (~) in front of the asterisk in the criteria cell: Good~*Eats
Most of the examples below use formulas in the criteria area. When you use a formula:
This video shows an example.
To follow along with the examples on this page, get the Excel workbook with these Advanced Filter criteria examples and sample data. The zipped workbook is in xlsx format, and does not contain any macros.
For all of the examples shown below, you will follow these steps, to run the Advanced Filter tool, after setting up the criteria area.
NOTE: If you want to send the data to a different sheet, follow the steps in the section Send Data to Another Sheet, below
When the Advanced Filter dialog box opens, follow these steps:
To get the Top 5 records with an Advanced Filter, or any other number of top records, use the LARGE function in the criteria, to find rows with the highest values.
Because there is a formula in cell F2, the criteria heading (F1) is left blank.
Instead of typing 5 in the formula, put that number in a cell, and refer to that cell in the criteria formula.
This makes it easy to change the "Top 5" into the "Top 10" or any other number.
In this example, the filter will extract the five records with highest totals, for records that were entered on or after a specific date. If you download the sample file, there is also an example for finding the highest totals within a specific date range.
NOTE: To see the steps for showing top 10 based on additional criteria in an AutoFilter, go to my blog post on Top 10 in Filtered Rows
In cell F2, the criteria formula checks two things:
In the screen shot below, the top five records with dates on or after Feb 3rd are in the filtered results.
This Advanced Filter criteria example extracts records where there is a matching value in two columns -- the Ordered date must be equal to the Shipped date.
Here's what's in the criteria range, in column F. The heading cell is left blank, because the criterion is a formula:
In each record, the Order date is compared to the Ship date. A relative reference is used for this -- C2 and D2.
The Excel Advanced Filter extracts the rows where the two dates are equal .
To see the steps for creating an Advanced Filter for unmatched amounts in a row, please watch this short video. The written instructions are shown below.
This Advanced Filter criteria example extracts records where there are unmatched values in two columns -- the Invoice Amount is not equal to the Paid amount.
Here's what's in the criteria range, in column F. The heading cell is left blank, because the criterion is a formula:
In each record, the Invoice amount is compared to the amount Paid. A relative reference is used for this -- C2 and D2. Rows where the amounts are not equal are displayed.
Note: You can use a column heading in the criteria formula, instead of a cell reference. The formula will return the #NAME? error or #VALUE! error, but the filter will work correctly. For example:
This Advanced Filter criteria example extracts records where there is an 8, anywhere within the OrderID number.
Here's what's in the criteria range, in column F. The heading cell is left blank, because the criterion is a formula:
The FIND function looks for the string "8" in the contents of cell C2.
If it finds the number, the result is the location of the number in the string. If the number is not found, an Error is the result.
This video shows the steps for creating an Advanced Filter for rows with blank cells, please watch this short video. The written instructions are shown below the video.
This is the option shown in the video, above. Use these criteria range settings to filter rows with blank cells
In each record, the value in column C is checked. If it is an empty string, the record passes through the Excel advanced filter.
Use these criteria range settings to filter rows with blank cells
In each record, the value in column C is checked. If the cell is empty, the record passes through the Excel advanced filter.
You can create a list of items on a worksheet, then filter another list, to show only the records that contain those items. There are 2 examples below:
For more examples, see the Filter with Criteria List page.
The COUNTIF function is used in the Criteria range, to check each record, and test for the list items. Rows with an exact match are returned in the filter. Written instructions are below the video.
Two criteria are used in this advanced filter
NOTE: To filter the results to a different sheet, start the filter from the destination sheet. See the details here.
To set up the Advanced Filter:
In each record, the value in column C is checked. If it is in the list in column I, and the total is greater than 1000, the record passes through the Excel advanced filter.
The SUMPRODUCT and COUNTIF functions are used in the Criteria range, to check each record, and test for the list items. Rows that contain an item in the list, anywhere in the Product cell, are returned in the filter.
Two criteria are used in this advanced filter
To set up the Advanced Filter:
In each record, the value in column C is checked. If it contains an item from the list in column I, and the total is greater than 100, the record passes through the Excel advanced filter.
Criteria Examples: Get the Excel workbook with these Advanced Filter criteria examples. The zipped workbook is in xlsx format, and does not contain any macros.
Match Items in List: Get the Excel workbook used in the video, Filter to Match Items in List. The zipped workbook is in xlsx format, and does not contain any macros.
Last updated: August 18, 2022 8:55 PM