Excel Advanced Filter – A Complete Guide with Examples

Sumit Bansal
Written by

Sumit Bansal is the founder of TrumpExcel.com and a 13-time Microsoft Excel MVP. He started this site in 2013 to share his passion for Excel through easy tutorials, tips, and training videos, helping you master Excel, boost productivity, and maybe even enjoy spreadsheets!

Last updated

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.

You’ll see how to pull out unique records, filter on AND and OR conditions, use wildcards and formulas as criteria, and copy the results to another sheet.

Follow along with the example file

Excel Advanced Filter Examples.xlsx

Download

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 Joe and the region is either Asia or Europe (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).

Now let’s have a look at some examples on using the Advanced Filter in Excel.

Extract a Unique List Using Excel Advanced Filter

You can use Excel Advanced Filter to quickly extract unique records from a data set (or in other words remove duplicates).

In Excel 2007 and later versions, there is an option to remove duplicates from a dataset. But that alters your existing data set.

To keep the original data intact, you need to create a copy of the data and then use the Remove Duplicates option. Excel Advanced filter would allow you to select a location to get a unique list.

If you’re using Excel 2021 or later, or Microsoft 365, the UNIQUE function is another option. It gives you the unique list with a formula, so the list updates when your data changes.

Let’s see how to use an advanced filter to get a unique list.

Suppose you have a dataset as shown below (this is the Unique Records sheet in the example file), and you want the unique records in columns E to G.

Sales dataset with three pairs of duplicate records highlighted in yellow and an empty result area in columns E to G

As you can see, there are duplicate records in this data set (highlighted in yellow). 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:

  1. Select the entire data set (including the headers), which is A1:C20 in this example.
Dataset in A1:C20 selected, including the headers
  1. Click the Data tab, then click Advanced in the Sort & Filter group. (You can also use the keyboard shortcut Alt + A + Q on Windows). This will open the Advanced Filter dialog box.
Advanced option in the Sort and Filter group on the Data tab
  1. 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 (A1:C20). 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 (E1:G1, which has a copy of the headers).
    • Unique records only: Check this option.
Advanced Filter dialog box set to copy unique records from A1:C20 to E1:G1 with the Criteria range left empty
  1. Click OK.

This will instantly give you a list of all the unique records. In this example, the 19 records come down to 16.

A record counts as a duplicate only when every column matches. That’s why Joe still appears more than once in the result (his 4 rows become 3, because only one of them was an exact repeat).

Unique records copied to columns E to G, with 16 records left

Important: 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 record as the header.

If you want each name listed only once, you can get the unique values from just one column.

Use only that column as the List range (B1:B20 for the Sales Rep names) and an empty cell such as I1 as the Copy to cell, and you get the 9 names.

Filter on Multiple Criteria with 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 (this is the AND – US Over 5000 sheet in the example file) and you want to quickly get all the records where the sales are greater than 5000 and the region is the US.

Sales dataset with date, sales rep, region, and sales, and an empty result area below F4:I4

Here is how you can use Excel Advanced Filter to filter the records based on the specified criteria:

  1. The first step when using Excel Advanced Filter with complex criteria is to specify the criteria. To do this, copy the headers and paste them somewhere in the worksheet (F1:I1 in this example).
Dataset headers copied to F1:I1 for the criteria

Remember, the headers in the criteria should be exactly the same as that in the data set. If a header has a typo, Excel can’t match the condition under it and you get no records at all.

  1. 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).
US entered below Region and greater than 5000 entered below Sales in the criteria
  1. Select the entire data set (including the headers).
Dataset in A1:D17 selected, including the headers
  1. Click the Data tab, then click Advanced in the Sort & Filter group. This will open the Advanced Filter dialog box.
Advanced option in the Sort and Filter group on the Data tab
  1. 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 filtered records.
    • List range: Make sure it refers to the dataset you want to filter (A1:D17). 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:I2.
    • Copy to: Specify the cell address where you want to get the filtered records. In this example, it’s F4:I4, which has a copy of the headers. If you don’t have the headers in place, you can enter a single empty cell instead, and Excel adds all the headers for you.
    • Unique records only: Leave this unchecked. If you check it, any record that appears twice in your data shows up only once in the result.
Advanced Filter dialog box with the list, criteria, and copy to ranges filled in and Unique records only unchecked

Important: Include only the rows that have criteria in the Criteria range. If it also includes a blank row (F1:I3 here), Excel reads that blank row as no condition at all and gives you every record.

  1. Click OK.

This would instantly give you all the records where the region is the US and the sales are more than 5000.

Two US records with sales over 5000 copied to F4:I6

Note that the result is a snapshot. If you change a criterion or the data later, the copied records stay as they are, so you need to run the Advanced Filter again.

Advanced filtering cannot be undone when copied to other locations, so double-check the Copy to range before you click OK.

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 in Advanced Filter

When you want to use AND criteria, you need to specify it below the header, with all the conditions in the same row.

For example, to filter records when the region is the US AND the sales rep is Bob, enter Bob below Sales Rep and US below Region (this is the AND – US and Bob sheet in the example file).

Bob entered below Sales Rep and US entered below Region in the same row

In the Advanced Filter dialog box, use A1:D17 as the List range, F1:I2 as the Criteria range, and F4:I4 as the Copy to range. This gives you the two records for Bob in the US.

Two records for Bob in the US copied to F4:I6

To filter records when the region is the US AND the sales value is greater than 5000, enter US below Region and >5000 below Sales. This is the example we did above (the AND – US Over 5000 sheet in the example file).

US entered below Region and greater than 5000 entered below Sales in the same row

To filter records when the region is the US AND the sales are recorded after 31-Mar-2025, enter >31-Mar-2025 below Date and US below Region (this is the AND – US After Date sheet in the example file).

Greater than 31-Mar-2025 entered below Date and US entered below Region

With the same three ranges in the dialog box, you get the five US records after that date.

Five US records after 31 March 2025 copied to F4:I9

Excel reads a date in a criteria cell using your computer’s regional settings. So on a PC set to US dates, >31-03-2025 returns nothing, because Excel can’t read 31-03 as a date there.

That’s why I’ve spelled out the month here. If that doesn’t work on your PC, enter =">"&DATE(2025,3,31) in the cell instead, because the DATE function gives Excel the date without any format to guess at.

Using the OR Criteria in Advanced Filter

When you want to use OR criteria, you need to specify the criteria in different rows. They can be in the same column or in different columns.

For example, to filter records when the region is the US OR the region is Asia, enter US and Asia one below the other below Region (this is the OR – US or Asia sheet in the example file).

US and Asia entered one below the other below Region

Since the criteria now take up two rows, use F1:I3 as the Criteria range and F5:I5 as the Copy to range, with A1:D17 as the List range. This gives you all 11 records for the US and Asia.

Eleven records for the US and Asia copied to F5:I16

To filter records when the Sales rep is Bob OR Martha, enter both names one below the other below Sales Rep (this is the OR – Bob or Martha sheet in the example file).

Bob and Martha entered one below the other below Sales Rep

With the same three ranges in the dialog box, you get the four records for Bob and Martha.

Four records for Bob and Martha copied to F5:I9

The conditions don’t have to be in the same column.

To filter records when the region is Asia OR the sales are greater than 8000, enter Asia below Region in the first row and >8000 below Sales in the second row (this is the OR – Asia or Over 8000 sheet in the example file).

Asia below Region in the first row and greater than 8000 below Sales in the second row

A record has to match only one of the two rows, so with the same three ranges you get seven records. That includes the Martha and Bob records from outside Asia, because their sales are above 8000.

Seven records that are in Asia or have sales over 8000 copied to F5:I12

Pro Tip: 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.

Combine AND and OR Criteria in Advanced Filter

You can use both in the same filter. Suppose you want the records where the sales rep is Joe and the region is either Asia or Europe.

To do this, enter Joe and Asia in the first criteria row, and Joe and Europe in the second row (this is the AND OR – Joe Asia or Europe sheet in the example file).

Joe and Asia in the first criteria row, and Joe and Europe in the second row

Make sure Joe is in both rows. If you enter it only in the first row, the second row asks for every Europe record, no matter who the sales rep is.

Use A1:D17 as the List range, F1:I3 as the Criteria range, and F5:I5 as the Copy to range. This gives you Joe’s three records.

Three records for Joe copied to F5:I8

Filter Values Between Two Numbers

To filter a range of values, you need two conditions on the same column, which means the same header has to appear twice in the criteria.

Below is the sales dataset (this is the Between 5000 and 7000 sheet in the example file), and I want the records with sales between 5000 and 7000. The criteria have two Sales headers, with >5000 below one and <7000 below the other.

Two Sales headers in the criteria with greater than 5000 and less than 7000

Both conditions are in the same row, so a record has to meet both. Use A1:D17 as the List range, F1:J2 as the Criteria range, and F4:I4 as the Copy to range to get the four records in that range.

Four records with sales between 5000 and 7000 copied to F4:I8

Filter for an Exact Match in Advanced Filter

When you enter text as a criterion, Advanced Filter looks for any value that begins with that text, and it ignores upper and lower case. This is easy to miss, because most of the time the result looks right.

Below is a dataset where I have entered Tom below Sales Rep, and I want the records for Tom in columns F to I (this is the Text – Starts With Tom sheet in the example file).

Tom entered below Sales Rep in the criteria

Use A1:D17 as the List range, F1:I2 as the Criteria range, and F4:I4 as the Copy to range. You get two records, because Tommy also begins with Tom.

Records for Tommy and Tom copied to F4:I6 because both begin with Tom

To get only Tom, enter the below formula in the cell below Sales Rep (this is the Text – Exactly Tom sheet in the example file):

="=Tom"
Exact match criterion in G2 with only the record for Tom copied to F4:I5

With the same three ranges, you now get only the one record for Tom. The equal sign in what the cell displays (=Tom) is what tells Advanced Filter to match the whole value and not just the beginning.

Don’t type =Tom directly though, because Excel would treat it as a formula and give you a #NAME? error. Also note that this still ignores case, so ="=tom" gives you the same record.

Follow along with the example file

Excel Advanced Filter Examples.xlsx

Download

Using Wildcard Characters in Advanced Filter

Excel Advanced Filter also allows the usage of wildcard characters while constructing the criteria.

There are three wildcard characters in Excel:

  1. * (asterisk): It represents any number of characters. For example, ex* could mean excel, excels, example, expert, etc.
  2. ? (question mark): It represents one single character. For example, Tr?mp could mean Trump or Tramp.
  3. ~ (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, enter J* below Sales Rep (this is the Wildcard – Starts With J sheet in the example file).

J followed by an asterisk entered below Sales Rep

Note that * represent any number of characters. So any rep with the name starting with J would be filtered with these criteria.

Use A1:D17 as the List range, F1:I2 as the Criteria range, and F4:I4 as the Copy to range. This gives you the six records for Jenny and Joe.

Six records for Jenny and Joe copied to F4:I10

Since text criteria already look at the start of a value, a plain J would give you the same six records here. Wildcards get more useful when the text you want isn’t at the start.

For example, to filter records where the name has “ar” anywhere in it, enter *ar* below Sales Rep (this is the Wildcard – Contains ar sheet in the example file).

The text ar between two asterisks entered below Sales Rep

With the same three ranges, you get the two records for Martha.

Two records for Martha copied to F4:I6

Similarly, you can use the other two wildcard characters as well.

The tilde is for values that really have a wildcard character in them. For example, if a sales rep was entered as Joe*, then Joe~* finds only that value, while Joe* would find every name starting with Joe.

Just remember that a criterion like ?o? still works as a begins-with match, so it also picks up Tommy. To limit it to three-letter names like Bob, Joe, and Tom, enter it as ="=?o?".

Use a Formula as the Criteria in Advanced Filter

Some conditions can’t be typed as a simple value, such as sales above the average. For these, you can use a formula that returns TRUE or FALSE as the criteria.

There are three rules for this, and getting any of them wrong gives you the wrong records:

  • The label above the formula can’t be a header from your dataset. Use your own text (or leave it blank). With a real header such as Sales above the formula, you get no records.
  • Refer to the first data row with a relative reference, such as D2 for the first sales value. Excel moves this reference down as it checks each record. If you lock it (D$2), Excel checks the same cell every time, so you get either every record or none of them.
  • Make every other reference absolute, such as $D$2:$D$17 for the whole Sales column. Otherwise, this range would shift down along with D2, and the formula would stop looking at the full column.

Below is the sales dataset (this is the Formula – Above Average sheet in the example file), and I want the records with above-average sales in columns H to K.

Sales dataset with an Above Average label in F1 and an empty result area in columns H to K

Here is the formula to enter in F2, with Above Average as the label in F1:

=D2>AVERAGE($D$2:$D$17)

Use A1:D17 as the List range, F1:F2 as the Criteria range, and H1:K1 as the Copy to range. This gives you the six records with sales above the average of about 5465.

AVERAGE criteria formula in F2 and six above-average records copied to columns H to K

F2 shows TRUE because it only has the result for the first record (6238 is above the average). Excel runs the formula for every record when you click OK.

If you add more rows to your data, extend $D$2:$D$17 to cover them.

You can also use this to filter against a list.

Below I have a list of sales reps in H2:H3 (this is the Formula – Reps on a List sheet in the example file), and I want all the records for these reps in columns J to M.

Sales dataset with an On List label in F1, a list of reps in H1:H3, and an empty result area in columns J to M

Here is the formula to enter in F2, with On List as the label in F1:

=COUNTIF($H$2:$H$3,B2)>0

Use A1:D17 as the List range, F1:F2 as the Criteria range, and J1:M1 as the Copy to range. This gives you the five records for Joe and Bob.

COUNTIF criteria formula in F2 and five records for Joe and Bob copied to columns J to M

The COUNTIF function checks whether the sales rep in each record appears in the list. F2 shows FALSE because the first record is for Jenny, who isn’t on the list, and that’s fine.

If you add a name to the list, extend $H$2:$H$3 to include it. Also note that the COUNTIF function ignores case, so joe on the list would also match Joe.

Copy Only the Columns You Want with Advanced Filter

When your Copy to range has all the headers, you get all the columns. If you only need some of them, type just those headers where you want the result and use them as the Copy to range.

Below is the sales dataset (this is the Chosen Columns sheet in the example file), and I want only the Sales Rep and Sales columns for the Asia records in columns F and G.

Sales dataset with Asia as the criterion and only the Sales Rep and Sales headers in F4:G4

Use A1:D17 as the List range, F1:I2 as the Criteria range, and F4:G4 as the Copy to range. This gives you the two columns for the five Asia records.

Sales Rep and Sales columns for the five Asia records copied to F4:G9

Copy Advanced Filter Results to Another Sheet

You can also get the result on a different sheet from your data, but you need to start from the sheet where you want the result.

Below is a sales dataset on the Sales Data sheet in the example file, and I want the Europe records on the Filtered Sales sheet.

Sales dataset on the Sales Data sheet

Here are the steps to do this:

  1. Go to the Filtered Sales sheet, which has the criteria in A1:A2.
Filtered Sales sheet with Europe as the criterion in A1:A2 and an empty result area below A4:D4
  1. Click the Data tab, then click Advanced in the Sort & Filter group.
Advanced option in the Sort and Filter group on the Data tab of the Filtered Sales sheet
  1. In the Advanced Filter dialog box, select ‘Copy to another location’, then click in the List range box and select A1:D17 on the Sales Data sheet. Use A1:A2 as the Criteria range and A4:D4 as the Copy to range.
Advanced Filter dialog box with the List range pointing to the Sales Data sheet
  1. Click OK.

This gives you the five Europe records on the Filtered Sales sheet, while your data stays where it is.

Five Europe records copied to A4:D9 on the Filtered Sales sheet

Important: If you start from the Sales Data sheet and point Copy to at another sheet, Excel stops you with the error “You can only copy filtered data to the active sheet”. Close the dialog box and start again from the destination sheet.

Follow along with the example file

Excel Advanced Filter Examples.xlsx

Download

Filter the Data in Place with Advanced Filter

You don’t have to copy the result anywhere. If you want to hide the rows that don’t match, like the regular filter does, you can filter the data in place.

Below is the sales dataset (this is the AND – US Over 5000 sheet in the example file), and I want to see only the US records with sales over 5000 in the dataset itself.

Sales dataset before filtering it in place

In the Advanced Filter dialog box, select ‘Filter the list, in-place’, use A1:D17 as the List range and F1:I2 as the Criteria range, and click OK. Excel hides the 14 rows that don’t match.

Dataset filtered in place, with only rows 2 and 17 showing below the headers

Excel hides the entire row, so anything next to your data on those rows gets hidden too. In this sheet, that includes the records copied to F4:I6 in the earlier example.

To get all the rows back, click the Data tab and then click Clear in the Sort & Filter group.

Advanced Filter vs the FILTER Function

In case you’re using Excel 2021 or later, or Microsoft 365, you should check out the FILTER function. It can do a lot of things that advanced filter can do with a simple formula.

Below is the same sales dataset (this is the FILTER Function sheet in the example file), and I want the US records with sales over 5000 in columns F to I.

Sales dataset with an empty result area in columns F to I

Here is the formula to enter in F2:

=FILTER(A2:D17,(C2:C17="US")*(D2:D17>5000))
FILTER formula in F2 spilling the two US records with sales over 5000

This gives you the same two records as the Advanced Filter example above, and the result spills down on its own. Multiplying the two conditions means a record has to meet both.

The big difference is that the FILTER function updates when your data changes, while the Advanced Filter result stays as it was until you run it again.

So the Advanced Filter is the one to use on older Excel versions, or when you want a copy that doesn’t change.

If no record matches, this formula gives a #CALC! error. The FILTER function has an optional third argument to show your own text in that case.

So these are some of the ways you can use the Excel Advanced Filter. If your result ever looks wrong, check the Criteria range first, because a blank row or a misspelled header changes what you get.

I hope you found this Excel tutorial useful.

Other Excel Articles You May Also Like:

Sumit Bansal

Sumit Bansal

13x Microsoft Excel MVP

Hey! I'm Sumit Bansal, founder of trumpexcel.com and a Microsoft Excel MVP. I started this site in 2013 because I genuinely love Microsoft Excel (yes, really!) and wanted to share that passion through easy Excel tutorials, tips, and Excel training videos. My goal is straightforward: help you master Excel skills so you can work smarter, boost productivity, and maybe even enjoy spreadsheets along the way!

20 thoughts on “Excel Advanced Filter – A Complete Guide with Examples”

  1. hi
    my question : how to use’ wild card’ when we have ‘between ‘ in the advance filter.
    question: if we want to find a product whos purchasing number is between 2000 to 5000 dollar or the salesperson is David

    Reply
  2. Am looking to filter out (that is, *exclude*) from the results any value in the data containing the letters ‘cul’ in a specific column. I don’t see here how to do that.

    Reply
  3. I want to filter a data set using advanced filter on “ram”. But the result includes not only “ram” but also the row containing “raman”. How do I get only the result for “ram”?

    Reply
  4. Hi, I have two columns A&B I need to see where column A data has different numbers in column B. So if column A has 123 and column B has two different numbers associated with 123 I need to see those highlighted in some way. Does anybody know how to do this?

    Reply
  5. I am trying to use formulas in my advanced-filter criteria where my database is in a separate (external) workbook from my extract sheet. It works if I don’t use a formula. Is this possible and, if so, what is the syntax?

    Reply
  6. I have a data containing score of students. I wish to obtain names of those students who have scored between 50 and 70 marks.

    Reply
  7. Hi, I have a query regarding excel. I want to filter with multiple items in a single column so can I do that without going into the dropdown? Please help

    Reply
  8. Your Tutorial is Mind blowing
    You Explained in detail and it is most useful.
    Please describe is you can, If there is a column of ‘Date of Birth’ and I want to extract only records that having their date of birth in November Month.
    Thanking You

    Reply
    • Suppose A2:A10 contains your dates, with the header in A1. Find a pair of blank cells, one below the other — I’ll assume E2 and E3. Leave E2 blank, and in E3 enter the formula `=MONTH(A2)=11` (specifically, A2 is the first data cell in the date column, and November is the 11th month). Apply an advanced filter, using A1:A10 as the list range, and E2:E3 as the criteria range.

      Reply
  9. dude you are awesome. Thank you. I was just searching the shortcut for search option in filter which A+ down arrow+ E… but here I learned some thing highly valuable.

    Reply

Leave a Comment

Get the FREE 51 Excel Tips Ebook

Enter your details and the free PDF is on its way to your inbox.

Hmm, that didn't go through. Please check your email and try again.

No spam. You'll also get my weekly Excel newsletter. Unsubscribe anytime.

Check your inbox!

The ebook is on its way to your email. It usually lands within a couple of minutes.