Clearing Only Filtering Settings

by Allen Wyatt
(last updated January 6, 2021)


On many of his worksheets, Roy uses sorting and filtering extensively. On the Data tab of the ribbon, in the Sort & Filter group, there is a Clear tool. This tool clears all filtering and sorting settings. Roy routinely needs to clear the filtering settings, but he would like his sorting settings to remain unaffected by the clearing. He wonders if there is a way to either change how this tool behaves or to clear only the filtering settings in a single action.

This was an interesting problem to research, and it took a bit of poking and prodding. It appears that Excel allows you to define sorting settings for the filters you apply to a data set. To see this in action, follow these steps:

  1. Open a workbook that has some data in it, or create a workbook that has data you can sort and filter.
  2. Select a cell within the data.
  3. Display the Data tab of the ribbon.
  4. Click the Filter tool, within the Sort & Filter group. Excel places drop-down arrows at the top of each column in your data.
  5. Click the drop-down arrow at the top of one of the column.

Note that the drop-down menu that appears allows you to select which data is filtered in the column. This is where people normally stop looking, though. It is interesting that at the top of the drop-down menu there are some sorting controls. If you use these controls, then the filtered results that Excel displays are filtered according to your specifications.

If you turn on the macro recorder at this point (after applying a filter that includes sorting) and click the Clear tool, this is the macro that is recorded by Excel:

Sub Macro1()
' Macro1 Macro

End Sub

Note that there are two lines in the recorded macro. The first line clears the sorting settings and the second clears all the filtering settings. If you record the same steps without having first chosen a sorting setting in the drop-down filtering menu at the top of a column, then Excel doesn't include the first line.

The upshot of this is that you can easily create your own single-line macro that removes any filtering but retains any sorting settings made through the filtering drop-down. The simple macro would look like this:

Sub ClearFilter()
End Sub

It should be noted that if you turn off filtering (by clicking a second time on the Filter tool), Excel automatically clears any filtering and sorting settings you may have applied. If you want to retain sorting settings—particularly complex sorting settings—outside of the filtering framework, then it would be best to record a macro of the steps you go through for sorting your data.


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 (12254) applies to Microsoft Excel 2007, 2010, 2013, and 2016.

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. ...


Inserting the Date and Time

Inserting a date and time in your document is a snap using the tools provided in Word. Just pick the command, then ...

Discover More

Finding Fields

Fields allow you to add simple dynamic content to your document. Here's how you can find the fields when you need to know ...

Discover More

Counting Lists

Word makes it easy to add both numbered lists and bulleted lists to your document. If you are working with longer ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Using a Filtered Value in a Formula

Accessing filtering criteria for use in a formula can be a real need for some worksheet designs. Getting to that ...

Discover More

Performing Calculations while Filtering

The advanced filtering capabilities of Excel allow you to easily perform comparisons and calculations while doing the ...

Discover More

Counting Filtered Rows

The filtering capabilities of Excel are indispensable when working with large sets of data. When you create a filtered ...

Discover More

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

View most recent newsletter.


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 eight more than 8?

2018-07-01 20:43:09

William Howard Benson

Does not work if your activecell is not in the filtered range. In fact I have been questing for a means to unfilter, without removing autofilter, every table and any non-table filtered range on a worksheet. This one comes close, and does not require selecting in a table... but unfortunately as in your example above, it does *not* work for the rest of the filtered data on a worksheet without selecting at least one cell in the filtered region.

Sub UnfilterEverywhere()
Dim LO As ListObject
With ActiveSheet
For Each LO In .ListObjects
With LO
If Not LO.AutoFilter Is Nothing Then
LO.ShowAutoFilter = False
LO.ShowAutoFilter = True
End If
End With
On Error Resume Next
On Error GoTo 0
End With
End Sub

2016-11-09 10:32:59

Scott L

As my mother used to say "fer dumb!" You're right. Guess my muscle memory is better than my brain memory...

It's just a plain old "e", no "ctrl" necessary. At least in Excel 2010, 2013 and 2016. Win10 machines.

I discovered it by accident. It always annoyed me that there's an "alt+arrow+letter" shortcut to all the other options in the drop-down, but not to the edit box. One time I started typing before arrowing or mousing down and realized that an "e" I had typed had taken me there.

Yes, alt+arrow+c does clear the filter, but requires the top cell to be active. The macro keeps whichever cell is selected active without having to note the row or highlight it to find it again, which is something I often want.

2016-11-08 06:24:27

Willy Vanhaelen

@Scott L

Didn't know about Alt + Arrow. Very usefull.

But what do you mean with "Ctrl+e takes you to the edit box".
Ctrl+e just beeps on my system (Win 7, Excel 2007).

Playing around I found that with the top cell selected, Alt+arrow+c clears the Filter.

2016-11-07 14:35:48

Scott L

I use AutoFilter all the time. Here’s a couple of useful shortcuts:
With a top cell of any AutoFiltered range selected, Alt+Arrow(either up or down) opens the AutoFilter drop-down for that column.
With the drop-down open, Ctrl+e takes you to the edit box.

Also, I often want to remove the filter from a single column while leaving other filtered columns filtered.
I’ve assigned this macro to a shortcut key to reset the column filter for the active cell column without having to open the drop-down and click Select All:

Sub ResetColumn()
ActiveSheet.Cells.AutoFilter Field:=Selection.Column
End Sub

This Site

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

Newest Tips

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.