Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Toggling AutoFilter.

Toggling AutoFilter

Written by Allen Wyatt (last updated January 4, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003


One of the handy features of Excel is AutoFilter. It allows you to quickly filter any list by the contents of a particular column. You can use the Customize option from the Tools menu to add an AutoFilter tool to your toolbars. This tool uses an image of a funnel and an equal sign.

The tool is a bit deceptive, however; it is not the same as the AutoFilter option available from the Data menu. If you have a cell selected in a list and you choose the menu option, then the AutoFilter controls appear at the top of each column in the list—there are no other changes to the list. If you use the AutoFilter tool, not only do the controls appear, but Excel filters the list based on the cell you had selected when you used the tool.

Another difference between the two is that the AutoFilter menu option functions like a toggle—choose it once, and the AutoFilter is applied; choose it again and it is removed. The AutoFilter tool doesn't do that; it only applies the AutoFilter.

What if you want a toolbar option that is a real toggle, just like the menu option? There are two approaches you can use to solve this problem. The first involves the use of a simple macro:

Sub ToggleAutoFilter()
    On Error GoTo errMessage
    Selection.AutoFilter
    Exit Sub

errMessage:
    MsgBox "Select a cell in the range to be filtered.", vbOKOnly
End Sub

All you need to do is assign the macro to a toolbar button or to a shortcut key and you can turn AutoFilter on and off, just as if you selected the option from the menus.

The second option may be even simpler. Just follow these steps:

  1. Choose Customize from the Tools menu. Word displays the Customize dialog box.
  2. In the actual Excel menus (not the Customize dialog box), select the Filter option from the Data menu.
  3. As you hold down the Ctrl key, drag the AutoFilter option from the menus and drop it someplace in a toolbar. (If you don't hold down the Ctrl key, the menu option is moved. You don't want to do this, so hold down the Ctrl key.)
  4. Click on the Close button on the Customize dialog box.

The result is that the menu option is now accessible from the toolbar. You can click on it to turn AutoFilter on and off, at will.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2710) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Toggling AutoFilter.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Summing Every Fourth Cell in a Row

Need to sum a series of cells that fits some regular pattern? Here are several ways that you can get the summation that ...

Discover More

Getting User Input in a Dialog Box

Want to grab some interactive input from a user in your macro? The best way to do that is with the InputBox function, ...

Discover More

Full-Width Headers and Footers in Excel

Excel allows you to create headers and footers. In this tip you discover that the headers and footers in Excel may not be ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (menu)

Changing AutoFilter Drop-Down Arrow Colors

The drop-down arrow used at the top of columns by AutoFilter can be difficult to see. Here's a way you can reduce the ...

Discover More

Limits to Filtering

Excel limits the number of items that can be shown in an AutoFilter drop-down list. Granted, it is a high limit, but it ...

Discover More

Filtering to a Date Range in the Past

If you have a large number of data records, each with an associated date, you might want to filter that data so you see ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 - 0?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.