Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

(80% Discount Ends Soon!)

How to Filter Data in Excel

Thanks to everyone who responded with some great ideas. Another user
verified that when using the Copy function of Advanced Filter, when it
copies and theres already data in cells anywhere below the targeted area, it
wipes them clean.

What I ended up doing was Advanced Filter / Copy to another location on the
same sheet out of the view area...then referenced those cells on Sheet 2
instead of doing a copy to Sheet 2. Problem solved.

Now my only issue is when I protect the sheet, and try to run the macro
that runs the Advanced Filter it says it can't run on a protected sheet. Is
there any way around this? I want to protect the sheet because it's
basically a form that end users will use over and over and if data in any of
the formula cells gets changed, it will mess up the rest of application.
Thanks again.

I've got this strange problem. I've highlighted an area (A1:H10 for example) which has data in it and selected auto filter. I would usually expect to be able to select from a drop down box from the title row but no drop down box or indicator of a drop down box exists. I go back to turn auto filter on again but I find that it has been turned on. I've been doing this with success for the last month with this spreadsheet but it just stopped working today after a made a few VBA changes to some code (not worksheets or workbook events but just module stuff).

Any ideas on why auto filter doesn't appear to work??


I have data in multiple sheets. Each row of data in each sheet is identified
with a text identifier. I can use auto-filter to select the prefered text
identifier in each sheet so that it shows only that data required. This is
slow and tedious.

I have also tried the Advanced filter referencing a Named cell which
indicates the indentifier. However, I still have to update each sheet
manually. Is there a way to automatically update the single filter on all
sheets simply by typing in the text identifier in a Named cell and pressing

Thanks in Advance,


I have series of data which i want to manage. For this, i used the custom
autofilter. Everything of this filter works, except the "begin with" and "end
with" filter! I don't know why. Really, i have tried everything.... Could
anybody help me on this please!!!


I am looking for a solution to the following filtering problem:
I have two adjacent columns, so using a filter for both of them is no
problem. But what I want to do and don't know how to do is this:
I want to filter for values greater than x (a certain number, in my
case 5000) in any of the two columns. I can filter both columns for x
greater than 5000 but that filters out more than I want because there
may be some cells with a value greater than 5000 in only one of the
two columns.

Is there a solution to this problem (using Excel alone or an add-on)?


Is there any way to automatically force an advanced filter to recalculate
when everything else does? If not, is there a simple way to force a filter

The only way I see to force an advanced filter to recalculate is too
basically redefine it.


I'm using Excel 2000. Recent problem. When I try to
apply a filter to any table of data, the table header
doesn't show the arrow buttons as part of each header
cell. There is no error message and when I go back to the
Data-Filter menu, the option is selected as normal.
Probably something simple but I can't find it. I've
rebooted and made simple tables to troubleshoot the
problem, but so far nothing.

Thanks much.


I suggest that Miscrosoft changes the color of the Filter Drop Down List
Arrows to Bright Red, when the column is filtered. Trying to distiguish the
non-filtered columns (black arrows) from the filtered columns (currently dark
blue) is almost impossible.

Make this drop down arrow Bright Red would make it easier and obvious that
the spreadsheet you are viewing is limited by a filtering critieria.

i hv an excel sheet with more than 60,000 rows of data (abt 8 columns)
i need to find one particular number in all that data. i use ctrl-f to
search for that number. excel says data can't be found. i do a filter on
that column with the numbers and do not see that number in the scroll down

BUT, that number IS in the sheet. after i found it (manually), the ctrl-f
works... excel magically finds what it could not find earlier. yet, the
filter scroll down list still does not display that number.

question: what is happening? is it because there is just too much data that
excel does not look in each and every cell?

hope someone can help. i just cannot keep manually searching through
thousands of rows... thanks in advance!

Message posted via http://www.officekb.com

Hi All,

I'm after a macro to that chooses a value from a filter drop down based on a value a user enters in a cell.

EG: There is a list of values in column B (say B1:B100). This list has an auto filter applied. A user enters "3" in cell A1 and runs the macro. The macro selects "3" from the drop down to filter the list.

Any thoughts/suggestions would be appreciated.

(note: the user cannot choose the value themselves from the drop down.)


Hi - I have set-up an advance filter but it only shows one record rather than
all records that meet the filter criteria. The unique box is not checked

Hi, My question relates to using filters. Why doesn't a count show in the
lower left corner of the window everytime I use a filter. Sometimes there is
a response that says "51 records out of 2,000 records retrieved" or something
similar. However, sometimes the records are retrieved but no count is
displayed. Thi sis a little thing but I am curious. Can any of you provide
an answer? I haved saved the spreadsheet and then used the filter, I have
closed and reopened the spreadsheet, I have cleared any previous filter and
then refiltered, etc. etc. but nothing changes. Sometimes a count is there,
other times no count. Thanks.


a column with no data, only different color fillings, how can I filter for a
specific color?

I receive the information analyzed manually and specific colors indicate
different status for production orders, and I want to write me a macro for
further analysis, but the only thing different from other orders is the
color filling of the row. Can I filter a cell's color filling (shade)???

I'm doing spreadsheets with built-in filters accessible through
buttons/macros. The advanced filters use criteria fields to determine
what data to filter, i.e., a column header with a < or> and the number
in the cell beneath it. I also have than number elsewhere in the
spreadsheet with a more "user-friendly" label. Is there a way to get
the filter criteria to refer to the other cell and apply a "greater
than" or "less than" to that number? In other words, the filter
criteria would point to the value in the other cell and apply a < or >
to that value. Any ideas?
Thanks in advance.

I have unchecked 'auto filter' but the arrows still remain and will not go
away. They do nothing, no drop downs.

Can anyone help?

I have a list of 408 people who need review for an award. However, of the
408 I have already entered an award for 193 people.

I have an Excel spreadheet which lists in column A the larger list and in
column B the people who already have the award. I am trying to filter the
unique records from column A by comparing column B. However, I do not seem
to be able to get the results I need; in fact I am getting no results.

Can anyone help? I was able to do this very function before with little
difficulty but seem to have a problem now.

Sorry if this is a bit vague. I can provide more information if needed.


Hi all - trying to set up a input box that becomes active as soon as
the user opens the workbook. The data primarily contains sales info
with country, region and city tags so I'd like the user to make a
choice upon opening within one of three possible filters (maybe they
just want to look at US or maybe they want to look at Missouri or maybe
they want to look at St. Louis).

I'd like for the user to basically choose from a list for what they
should be filtering on (instead of having to type it as input)

(Actually I wish my users could just get over the mental block of
making their own filter choices without having to set this up as a
macro but we aren't there yet...)

Can anyone offer assistance? Thanks if you are able - Gretchen

I'm filtering data in two columns c5:c3 and d5:d31. It's essentially a managers name and language code. The idea is to filter stats for a particular team or language. I've got my formulas working properly, but I've got some totals in rows b33:i33 through b38:i38 that I want to remain in place when I filter. I've tried auto filters, but they kill all the data that I want to remain static. Is there any way I can filter these columns (I only know autofilter right now) but get it to only filter information through row 31 ?

Is there a way for Auto Filter of columns to work when I'm using Groups as
well? If not are there similar options?

Dan Foxley

I've been using the same filtered worksheet all day and it has filtered to my
chosen item in the drop down list. All of the sudden, when trying to go from
one filtered item to the next, the filtered list doesn't appear when I try
clicking on the triangle. No changes have been made to the workbook and
freeze panes isn't on. Has anyone else had this happen? Is it a bug? The
only way of getting them back on is to unfilter the entire area, unhide the
rows, which are stuck to the last filtered items, and then reapply filters.

I'm using ActiveX checkbox in a spreadsheet and want to filter my data on
boxes that have checks - is this possible?

I have a large spreadsheet containing several hundred rows of data. I want
to filter the list and I want to be able to show the number of records that
match the filter criteria. For example, un-filtered the total number of
records in the list is displayed and, when filtered, the number of records in
the list that match the criteria is displayed.

Can onyone help me please?

Kind regards,


I want to exclude certain records from a pivot table... i.e.,

Buy/Sell Quantity
B 5,000,000.00
S 5,000,000.00
B 1,000,000.00
B 10,000,000.00
S 7,000,000.00
B 500,000,000.00
S 200,000,000.00

Only inlcude "B" records.
Can a pivot table be set up to filter?

Thanks ChrisP

I have a lot of data in a notepad file. This data contains information I
need to create a database. I want to put it in a Excel worksheet b/f I
transfer it into Access. The notepad file contains various information
packed up together, but seperated by comma's. All the information is in the
same order on the notepad file (For ex. MLS #, Address, City, St., Zip Code,
etc...). I was wondering if Excel 2003 canl search through the file, and
filter the different types of data I need from the ones I don't. Then insert
the data in a spreadsheet which will organize it according to its particular

I have a project timeline laid out in Excel. I'm trying to write an Advanced
Filter that will show me everything that has a "marker" in a specific week's
column, OR is a milestone, AND IS NOT completed.

The criteria below works for everything but the IS NOT COMPLETED part of the
query. What do I have to put under "Status", and in what rows, to filter OUT
those items that are completed?

Milestone? 5-Dec 12-Dec 19-Dec Status

I'm attempting to filter columns E, G, and I all at the same time. I need to
display rows that have values greater than 0 in any one of those three
columns. So far I can only filter progressively. If I filter column E and
then filter column G, the second filter is only applied to the results of the
first filter.

Does anybody know if it's even possible to do what I'm trying to do?

Is there a one stroke short-cut key to show all data if a filter is applied.
I know I can create a macro and assign a short-cut key to it and I know I can
do an Alt-D-F-S but was just wondering if there was already an existing

If there's not, no big deal, I'll manage.


I accidentally turned on some filter keys and have not been able to figure
out how to remove them from my document. Can anyone help me?

Don't know if it's possible...

I have and Excel spread sheet w/ 12000+ rows of data. With common data on
many of the rows. Is there a limit to the Filter? I'm not picking up all the
data. I have tried turning off the filter, save, and turning the column
filter back on.

I want to filter text in a column by its indent. The format is such that
each cell has text in it which is indented from the text above up to
8 indents. The sequence is then repeated. I want to filter out the 5th to
the 8th indents from the range.

Any ideas.

Is it possible to auto filter data, and use it as input to a Pivot table? When I run a test where I first auto filter, I initially had 20000 rows, and the auto filter reduced it to 12000 rows. But when I go to crearte a pivot table on the filtered data, I am back to a total record count of 20000. Am I combining apples and oranges? If so, is there a way to filter data, before it gets inputed to a Pivot table?

I would like to filter on the various items listed in a column, but when I go
to filter, the Auto Filter is grayed out. I have used Auto Filter on other
spreadsheets, but this one I can't get it to be available.

Need to allow filtering of a column with merged cells to show the rows
associated with each merged cell

When I turn on my Auto Filter and click the drop down arrow under one of my
column headers (ie. Dates), I don't always see all of the dates that are in
my Excel database. This seems to happen when I have more than 20,000 records
of data. Any assistance would be appreciated.

Not sure what this is, but it is a filter type looking bar on the left side of column A.....not sure what this is, but any help would be appreciated....


I'm looking for a way to data filter but have multiple rows of data displayed based on one cell of that data.

Each customer record contains 5 rows of data. The Data Filter would be selected based on the final column of Sale, Demo, or N/S.

If i pick Sale, then i need to see all 5 rows of data for that customer along with all other 5-row-data of any other customers with Sale in the last column.

I have attached a small version of my file.

Any suggestions would be much appreciated.

(i've tried to 'group' lines together, representing all lines for each customer, but when "data filter" is used, it only shows the one line for that customer)

Row filtering is a nice feature of Excel (AutoFilter or Advanced filter).
I would be very happy to offer the transposed feature in some of my Excel applications: hiding columns by selecting within a list.

Any idea about how to do that?
Any type of solution welcome.


im a newbie with macros. I need to do a horizontal filter for my data, I have found a macro for it but how do I incorporate it to my sheet?? any help would be greatly appreciate it, here is the link to the horizontal filter macro:



I'm not really sure if this would go under "General" or "Programming", but here goes a shot. I've never really used Excel before for anything serious. Anyways, in my current job I'm MIS Director for a small online retailer, and most of my day consists of running various reports sent to me via Excel against either Access or SQL back-ends for business operations.

In Excel 2007 I know how to import data from an external source (in this case, an Access database, but more often than not it's against a SQL Server instance). However, my current problem is thus: I have an Excel spreadsheet with some 7,000 product IDs in them, and I wish to check their price and run some minor calculations. While for this particular project I could easily import it into Excel and run a query, I'm thinking long-term.

Is there any way to filter imported data (i.e. a WHERE clause) based on the value of an Excel column? e.g. tell Excel (in pseudocode): "Import data from this Access database, for each row match up the ProductID in the database with the value of column 'A', and insert its corresponding Price value into column 'B'". I'm not seeing a way to do this, and it would make my job so much easier if I didn't have to import into SQL Server or Access, run queries and export back to another Excel file.

Hi All,
Below is a sample excel format. I enabled merge cells from A1..A5 and B7..B10. I enabled autofilter and when I filter with column A(Cat), I can see only one value of the corresponding column B. How can I view all values of B when filtered with A? (Auto filter with merged cells) will work?

Cat Val
a 23

b 56


I want to know if we can apply the auto filter for single column. In my attached I want to apply autofilters only for some columns but not for all the columns. If I select a column and apply the autofilter it is applying for all the columns. Pls suggest.

Hi all,

I have a pivot table which reads from a fairly large list of entries (about 17000 records). The table was tedious to build, so I typically update the data, then refesh the table to produce the new results. The issue I have is that the pivot table field filter dropdown boxes tend to accumulate obsolete data over time and I cannot figure out how to reset these so that only the current values are shown.

For instance, I have a field "Prog" which lists various programs in progress. When I created the table, Prog1, Prog2, and Prog3 existed, and the pivot filter dropdown listed all three. Over time, some of these programs completed, and the records were deleted so data no longer include Prog1 and Prog2. New programs Prog4 and Prog5 were also added. However, the field filter list box shows all 5. (While this is not a big deal with 5 projects, it is wihen the list climbs to 50.)

If anyone can tell me how to reset this without completely rebuilding the pivot table, I'd appreciate it. I'm using Excel 2003 SP3 and Windows XP.


Hi, I have an advanced filter that works perfectly, but is there any way to have it use this filter automatically when the document opens, instead of having to go to DATA -> FILTER -> ADVANCED FILTER-> OK every time I open it? I know it s just a little extra effort but I'm trying to impress my boss, thanks!

I'm using Excel 2003 and am trying to filter a list of values. The list has duplicate values in it. When I use Filter>Advanced Filter and select "Unique records only" the filter only eliminates some of the duplicates. If there are 4 values of 100, it may filter 2 of them or none at all. Ultimately I'm trying to end up with a list of values with no repeats. Any help is appreciated.


Hi Experts,

I want to call some function only when the pivot table page item filter is selected and not on row item filter. please let me know how to do that


I'm hoping somebody here knows more about excel than I do, sorry to post technical questions not related to admissions, but I could really use some help here.

I have a very large data sets that I'm working with in excel 2007 and I have to continually filter and unfilter the data by groups. I want to know if there's a way that I can have the values from my formula update themselves each time I filter/unfilter the data.

Suppose I have a table like this:
Group | Age | Rank | Gender
A 15 1 M
A 5 2 F
A 1 3 F
B 12 1 M
B 3 2 M
B 2 3 F

Where there are two groups, A and B, and each person has an age, and then the third column we have a ranking. This ranking in third column is computed by sorting the data by age and then by group, and then we set the first entry to 1 and then every other entry has an "if" equation where if the group is the same as the previous column then we add 1 to the ranking, and if not then we set it equal to 1.

Now say that just as a thought experiment we want to only look at females and have the rankings for females. If you do a basic filter and select only show girls what you get is:

Group | Age | Rank | Gender
A 5 2 F
A 1 3 F
B 2 3 F

However, what I want is:

Group | Age | Rank | Gender
A 5 1 F
A 1 1 F
B 2 2 F

Is there anyway to make the formula update like this, so it treats what we see as the first row of data as if it were actually the first row, instead of still the second row with the first row "invisible" but existent?

I know it's easy to do this in a one time thing through an advanced filter or simply deleting the rows I don't want; but I need to do literally hundreds of filters and don't want to delete anything. For example right after I look at only the female data I may want to do the same thing only looking at just the male data. Is there any easy way to do this?

I know you can have macro's work off relative position instead of absolute, is there anyway for formulas/filters to do this?

Thanks in advance!


I have a pivot table in which I have several filter options defined. The problem is that the filtering is done using "AND" conditions. I want to be able to filter where filter A value exists OR filter B value exists OR filter C value exists.

Is this possible without using the Advanced filter functionality?


Hello everyone, I am currently using conditional formating to color every other row of my spread sheet. Unfortuantley, when I utilize a FILTER, to filter the data fields, some of the rows are gone, and often, two even rows remain so they are the same color.

For example:

There is data fields...

1 - A
2 - B
3 - A
4 - B
5 - A
6 - A
7 - A
8 - A
9 - A
10 - A

If I filter for B, my spreadsheet will only display rows 2 & 4, both of which are the same color due to my conditional formatting (odd rows = one color, even rows = another). I am trying to make it so that these filtered cells would be of different colors, like my spreadsheet before any filters are applied.

I was hoping that somebody on the board could help me arrive to a solution regarding this problem. This problem only arises in FILTERING scenarios as SORTING does not remove any cells, merely reorganizes them, and my conditional formatting works fine.

Thank you very much for your time.