You are on page 1of 4

ADVANCED FILTERS

As you are now at the Advanced Level of Excel, you should be fully aware of

Excel's AutoFilter feature. While in most cases the AutoFilter is quite sufficient for most tables or lists,

there are times when you need to extract data that cannot be extracted via Excel's AutoFilter. Probably
the three biggest differences between the Advanced Filter and Excel's AutoFilter are:

1. Advanced Filter will allow us to nominate where we would like our filtered data to be

placed. The choices are: Filter the list, in place or Copy to another location.

2. Advanced Filter has a built-in function that will allow us to filter by unique records.
3. Advanced Filter allows us to use a formula as our criteria.

Before we go into detail on these, there are a couple of rules that must be adhered to when using the
Advanced Filter in certain ways.

1. In relation to Point 1 - The list must be filtered to a nominated range on the same Worksheet

as the list or table resides. This means simply if our list or table is on Sheet 1, Excel will not

allow us to nominate the Copy to another location option and copy to another Worksheet,

we have to copy to the same Worksheet that our list or table resides on. If you do wish to

copy to another Worksheet simply opt to Copy to another location on the same Worksheet,

then cut and paste the results to another Worksheet.

2. In relation to Point 3 - When we use a formula as our criteria, the formula itself must evaluate

to either True or False. We will be using formulas later, and you will see what I mean when
I show you the example.

Let's start off with something relatively simple, so download the attached workbook and and open the
file ExcLev3L02a.xls

In the table on the AdvancedFilters worksheet, the heading Names is in cell A6. The reason we have

started in this cell is because it is good practice to always leave at least three spare rows above your

data. We usually opt for more than this as we have 65536 rows in total. This is so we can use them for

setting a Criteria for an Advanced Filter. When you set a Criteria you refer to it using the Criteria

range box. Your criteria range should include the column headings of your List or Table. So we simply
copy our column headings to the top blank row. It is below these headings that we put our criteria.

An important point to note here is that column heading names should be unique. Again, this will become
apparent once we start using a criteria for our example.
When you first activate the Advanced filter, it will (by default) include all surrounding cells that have

data in them. This is known as the Current Region. For this to happen though you should select
any single cell within your table before activating the Advanced filter.

What we would like you to do now is copy the headings and paste to cells A1:C1. Now select the range
A6:C27 and name this MyRange. Then follow the steps below.

1. Type John in cell A2 and Dave in cell A3.

2. Select any cell within your Table and go to Data>Filter>Advanced Filter.

3. Select Filter the list in place.

4. Make sure your List range is correct. Advanced Filter will automatically pick up your list

range as you have clicked in a cell inside your list and your list is set up correctly. The List

range should be A6:C27, although you could type in MyRange if you prefer.

5. Put A1:A3 in our Criteria range box


6. Click OK

Our Table should now only display the information for John and Dave. All other rows should be hidden

in the same manner as the AutoFilter hides rows. In other words all visible rows will have blue row
numbers. To get or data back to how it was go to Data>Filter>Show All, do this now.

To add more names we could insert some more rows above our data and use these to add the extra

names. However we believe it is better to have the extra rows there to begin with, and as we have said
previously, leave at least three rows above your data and hide them.

Now all your data is visible again follow these steps.

1. Select any cell within your Table and go to Data>Filter>Advanced Filter.

2. Make sure our List range is correct. It should be A6:C27 (MyRange)

3. Put A1:A3 in our Criteria range box

4. Check the Copy to another location option.

5. Click the collapse dialog box to the right of the Copy to box.

6. Select cell F6 then click the expand dialog box.


7. Click OK

This time instead of the names that do not meet the criteria being hidden they are simply not included
in the copied table.
We could also extend our criteria to not only show John and Dave's information, but to show only John

and Dave IF they are aged between 25 and 52. To do this we would put: >24 in the cell directly below

our copied heading Age and <53 in the cell below this. Now apply the Advanced Filter and include the

new criteria in the Criteria box ie; A1:C3, although our new criteria for the age is in cells C1:C3. It wont
matter that there is no criteria in cells B1:B3 as blank cells are ignored.

Now return the Worksheet to how it was originally. In other words have the table only, but
retain the copied headings in row 1.

We can also use formulas as our criteria when using Advanced Filter, which can make our filtering
capabilities even more complex. However any formula we use:

1. Must evaluate to either TRUE or FALSE.

2. The formula we use, must use a relative cell reference to the first data cell in the column

we want to filter.
3. The range within the formula itself must be an absolute reference.

If we do not apply these three rules the Advanced Filter will not work as expected.

So let's say we wanted to find the information on the person who has the third largest pay rate. To do

this we need to place the formula: =B7=LARGE($B$7:$B$27,3) in cell B2. Where B7 is our first Pay
Rate and $B$7:$B$27 is the entire range below Pay Rate.

When we use the Advanced Filter this time we must not have our column heading Pay Rate in cell B1.

We would still refer our Criteria range in the Advanced Filter dialog to: $B$1:$B$2 but we cannot have
a column heading in B1 that is the same as one in the Table. In other words we use the formula cell

and a blank cell above it, or type any text just as long as it is not the same as a column heading from

our Table. For this example we will leave it blank, so delete the words Pay Rate from cell B1. Notice

also that we are using $B$1:$B$2 and not $A$1:$C$2. This is because we can only include
cells which do have a criteria set.

Now follow these steps:

1. Select any cell within your Table and go to Data>Filter>Advanced Filter.

2. Make sure our List range is correct. It should be A6:C27 (MyRange)

3. Put B1:B2 in our Criteria range box


4. Check the Copy to another location option.
5. Click the collapse dialog box to the right of the Copy to box.

6. Select cell F6 then click expand dialog box


7. Click OK

You should now have Jim - $21.00 - 40 as your result.

The other very handy feature of the Advanced Filter is that we can use it to create a List of Unique

records only. To do this we simply need to check the Unique records only box and leave the Criteria

range box blank. When we use this option it is usually using a single column as our List range. Try
this to see what we mean. But first remove all data leaving only your table.

1. Select any cell within your Table and go to Data>Filter>Advanced Filter.

2. Make your List range C6:C27

3. Ensure the Criteria range box is blank.

4. Check the Filter the list, in place option.

5. Check the Unique records only option.


6. Click OK

You should now have a filtered list which only shows one occurrence of each age!

We could also use this same method to show only one occurrence of duplicated row data, try this:

1. Copy A12:C12 and paste over the top of A11:C11

2. Select any cell within your Table and go to Data>Filter>Advanced Filter.

3. Make your List range A6:C27


4. Ensure the Criteria range box is blank.

5. Check the Filter the list, in place option.

6. Check the Unique records only option.


7. Click OK

This time, row 12 will be hidden as it is a duplicate of row 11.

We have included a Workbook example of Advanced Filters (ExcLev3L02b.xls) to give you an idea on

how they can be used. There is also some good information in the Excel help under: Filter a list using

advanced criteria that is worth reading. As with the use of most formulas in Excel, it can take some
trial and error before we get the result we want. However, making mistakes is a great way to learn!!!

You might also like