Excel Advanced Filter is one of the most underrated and under-utilized features that I have come across.
If you work with Excel, I am sure you have used (or at least heard about the regular excel filter). It quickly filters a data set based on selection, specified text, number or other such criteria.
In this guide, I will show you some cool stuff you can do using the Excel advanced filter.
But First… What is Excel Advanced Filter?
Excel Advanced Filter – as the name suggests – is the advanced version of the regular filter. You can use this when you need to use more complex criteria to filter your data set.
Here are some differences between the regular filter and Advanced filter:
- While the regular data filter will filter the existing dataset, you can use Excel advanced filter to extract the data set to some other location as well.
- Excel Advanced Filter allows you to use complex criteria. For example, if you have sales data, you can filter data on a criterion where the sales rep is Bob and the region is either North or South (we will see how to do this in examples). Office support has some good explanation on this.
- You can use the Excel Advanced Filter to extract unique records from your data (more on this in a second).
EXCEL ADVANCED FILTER (Examples)
Now let’s have a look at some example on using the Advanced Filter in Excel.
Example 1 – Extracting a Unique list
You can use Excel Advanced Filter to quickly extract unique records from a data set (or in other words remove duplicates).
Let’s see how to use an advanced filters to get a unique list.
Suppose you have a dataset as shown below:
As you can see, there are duplicate records in this data set (highlighted in orange). These could be due to an error in data entry or result of data compilation.
In such a case, you can use Excel Advanced Filter tool to quickly get a list of all the unique records in a different location (so that your original data remains intact).
Here are the steps to get all the unique records:
- Select the entire data set (including the headers).
- Go Data tab –> Sort & Filter –> Advanced. (You can also use the keyboard shortcut – Alt + A + Q). This will open the Advanced Filter dialog box.
- In the Advanced Filter dialog box, use the following details:
- Action: Select the ‘Copy to another location’ option. This will allow you to specify the location where you can get the list of unique records.
- List Range: Make sure it refers to the dataset from which you want to find unique records. Also, make sure headers in the data set are included.
- Criteria Range: Leave this empty.
- Copy To: Specify the cell address where you want to get the list of unique records.
- Copy Unique Records Only: Check this option.
- Click OK.
This will instantly give you a list of all the unique records.
Caution: When you are using Advanced Filter to get the unique list, make sure you have also selected the header. If you don’t, it would consider the first cell as the header.
Example 2 – Using Criteria in Excel Advanced Filter
Getting unique records is one of the many things you can do with Excel advanced filter.
Its primary utility lies in its ability to allow using complex criteria for filtering data.
Here is what I mean by complex criteria. Suppose you have a dataset as shown below and you want to quickly get all the records where the sales are greater than 5000 and the region is the US.
Here is how you can use Excel Advanced Filter to filter the records based on the specified criteria:
- The first step when using Excel Advanced Filter with complex criteria is to specify the criteria. To do this, copy the headers and paste it somewhere in the worksheet.
- Specify the criteria for which you want to filter the data. In this example, since we want to get all the records for the US with sales more than 5000, enter ‘US’ in the cell below Region and >5000 in the cell below Sales. This would now be used as an input in Advanced Filter to get the filtered data (as shown in the next steps).
- Select the entire data set (including the headers).
- Go Data tab –> Sort & Filter –> Advanced. This will open the Advanced Filter dialog box.
- In the Advanced Filter dialog box, use the following details:
- Action: Select the ‘Copy to another location’ option. This will allow you to specify the location where you can get the list of unique records.
- List Range: Make sure it refers to the dataset from which you want to find unique records. Also, make sure headers in the data set are included.
- Criteria Range: Specify the criteria we constructed in the steps above. In this example, it would be F1:I3.
- Copy To: Specify the cell address where you want to get the list of unique records.
- Copy Unique Records Only: Check this option.
- Click OK.
This would instantly give you all the records where the region is the US and the sales are more than 5000.
The above example is a case where the filtering is done based on two criteria (US and sales greater than 5000).
Excel Advanced filter allows you to create many different combinations of criteria.
Here are some examples of how you can construct these filters.
Using the AND Criteria
When you want to use AND criteria, you need to specify it below the header.
For example:
- To filter records when the region is the US AND the sales rep is Joe.
- To filter records when the region is the US AND the sales value is greater than 5000.
- When the region is the US AND the sales are recorded after 31-03-2017.
Using the OR Criteria
When you want to use OR criteria, you need to specify the criteria in the same column.
For example:
- To filter records when the region is the US OR the region is Asia.
- To filter records when the Sales rep is Bob OR Martha.
By now, you must have realized that when we have the criteria in the same row, it is an AND criteria, and when we have it in different rows, it is an OR criteria.
Example 3 – Using WILDCARD Characters in Advanced Filter in Excel
Excel Advanced Filter also allows the usage of wildcard characters while constructing the criteria.
There are three wildcard characters in Excel:
- * (asterisk) – It represents any number of characters. For example, ex* could mean excel, excels, example, expert, etc.
- ? (question mark) – It represents one single character. For example, Tr?mp could mean.
- ~ (tilde) – It is used to identify a wildcard character (~, *, ?) in the text.
Now let’s see how we can use these wildcard characters to do some advanced filtering in Excel.
- To filter records where the sales rep name starts from J.
Note that * represent any number of characters. So any rep with the name starting with J would be filtered with these criteria.
Similarly, you can use the other two wildcard characters as well.
Note: In case you’re using Office 365, you should check out the FILTER function. It can do a lot of things that advanced filter can do with a simple formula.
NOTE:
- Remember, the headers in the criteria should be exactly the same as that in the data set.
- Advanced filtering cannot be undone when copied to other locations.