Skip to main content

Kutools for Office — One Suite. Five Tools. Get More Done.

How to display / show auto filter criteria in Excel?

Author Xiaoyang Last modified

Auto Filter is a useful feature for Excel users, sometimes, we apply the Auto Filter to filter the data by multiple criterion and send the file to others. In this situation, if the other users want to know your filtered criterion, how could they do?

Display / Show auto filter criteria in worksheet with User Defined Function

Display / Show auto filter criteria in worksheet with VBA code

Display / Show auto filter criteria in worksheet with Kutools for Excel good idea3


Display / Show auto filter criteria in worksheet with User Defined Function

Supposing you have the following data which has been filtered by some criterion, see screenshot:

A screenshot of filtered data in Excel with auto filter applied

And now I can create a User Defined Function to display the filter criterion into the cells, please do with following steps:

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications Window.

2. Click Insert > Module, and paste the following macro in the Module Window:

Function AutoFilter_Criteria(Rng As Range) As String
'Updateby20140220
Dim str1 As String, str2 As String
Application.Volatile
With Rng.Parent.AutoFilter
    With .Filters(Rng.Column - .Range.Column + 1)
        If Not .On Then Exit Function
            str1 = .Criteria1
        If .Operator = xlAnd Then
            str2 = " AND " & .Criteria2
        ElseIf .Operator = xlOr Then
            str2 = " OR " & .Criteria2
        End If
    End With
End With
AutoFilter_Criteria = UCase(Rng) & ": " & str1 & str2
End Function

3. Then save and close this code, in a blank cell of a blank row, for example cell A1, enter this formula =AutoFilter_Criteria(A4) (A4 is the header cell of the filtered data), see screenshot:

A screenshot of entering the AutoFilter_Criteria formula in Excel

4. Then press Enter key, and then select cell A1, drag the fill handle over to right cells that you need to contain this formula, and all the criterion has been displayed into the cells, see screenshot:

A screenshot of displaying the auto filter criteria in Excel

Note: If there are more than two criteria in a column, this User Defined Function will not give the right result.


Display / Show auto filter criteria in worksheet with VBA code

Here, I can also talk about an interesting VBA code, it can help you to display the filter criteria in a cell of the workbook.

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications Window.

2. Click Insert > Module, and paste the following macro in the Module Window:

VBA code: Display auto filter criteria in worksheet

Sub ShowAutoFilterCriteria()
'Updateby20140219
Dim xFilter As AutoFilter
Dim TargetFilter As Filter
Dim TargetField As String
Dim xOut As String
Dim OutRng As Range
If ActiveSheet.AutoFilterMode = False Then
    Application.StatusBar = False
    Exit Sub
End If
xTitleId = "KutoolsforExcel"
Set OutRng = Application.Selection
Set OutRng = Application.InputBox("Cell", xTitleId, OutRng.Address, Type:=8)
Set xFilter = ActiveSheet.AutoFilter
For i = 1 To xFilter.Filters.Count
   TargetField = xFilter.Range.Cells(1, i).Value
   Set TargetFilter = xFilter.Filters(i)
   If TargetFilter.On Then
        On Error GoTo OutNext
        xOut = xOut & TargetField & TargetFilter.Criteria1
        Select Case TargetFilter.Operator
            Case xlAnd
            xOut = xOut & " And " & TargetField & TargetFilter.Criteria2
            Case xlOr
            xOut = xOut & " Or " & TargetField & TargetFilter.Criteria2
            Case xlBottom10Items
            xOut = xOut & " (bottom 10 items)"
            Case xlBottom10Percent
            xOut = xOut & " (bottom 10%)"
            Case xlTop10Items
            xOut = xOut & " (top 10 items)"
            Case xlTop10Percent
            xOut = xOut & " (top 10%)"
        End Select
    End If
Next
OutRng.Value = xOut
OutNext:
xOut = xOut & TargetField & "= Multiple Filters"
ErrorHandler:
Resume Next
End Sub

3. Then press F5 key to run this code, a prompt box will pop out to let you select a blank cell to put the criterion, see screenshot:

A screenshot of the VBA prompt to select a blank cell for filter criteria

4. And then click OK, all the criterion has been shown in the selected cell as follows:

A screenshot of auto filter criteria displayed in a cell

Note:

With this VBA code, if your criterion more than two in a column, it will not be showed the detailed filter criterion but displayed as follows:

A screenshot showing a column with multiple filter criteria in Excel


Display / Show auto filter criteria in worksheet with Kutools for Excel

If you have Kutools for Excel installed, you can apply its Super Filter function to filter data, and at the same time you can view the filter criteria anytime.

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Itegarate with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

1. Click Kutools Plus > Super Filter to display the Super Filter function. See screenshot:
A screenshot of the Kutools Super Filter option in Excel

2. In the Super Filter pane, click Range selection button to select the data range you want to filter then check Specified checkbox to fix the filter range. See screenshot:
A screenshot of selecting data range in the Super Filter pane

3. In the Super Filter pane, click a line in a filter group, then specify the filter criteria in the drop-down lists as you need, then click Ok to finish the criteria setting. See screenshot:
A screenshot of specifying filter criteria in the Super Filter pane

4. Click Filter, and the selected data has been filtered by the criteria, and at the mean while, you can view the filter criteria is displyed in the Super Filter pane. See screenshot:
A screenshot of filtered data with visible criteria in the Super Filter pane

Note: You can save the filter criteria as a scenario for next using with the Super Filter utility.

1. Click the Save current filter settings button, in the popping dialog, type a filter name.
A screenshot of saving the filter criteria scenario in Kutools

2. When you want to use this filer settings next time, click the menu button, then choose the scenario in the sub menu of Open saved filter settings scenario.
A screenshot of opening a saved filter criteria scenario in Kutools

Kutools for Excel - Supercharge Excel with over 300 essential tools. Enjoy permanently free AI features! Get It Now

Demo: Display Filter Criteria While Filtering using Kutools for Excel

Kutools for Excel: Over 300 handy tools at your fingertips! Enjoy permanently free AI features! Download Now!

Best Office Productivity Tools

šŸ¤– Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

All Kutools add-ins. One installer

Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.

Excel Word Outlook Tabs PowerPoint
  • All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
  • One installer, one license — set up in minutes (MSI-ready)
  • Works better together — streamlined productivity across Office apps
  • 30-day full-featured trial — no registration, no credit card
  • Best value — save vs buying individual add-in