How to Create a Filtering Search Box in Excel: Easy Guide
A filtering search box in Excel helps users quickly find specific information within large datasets. Whether you want to highlight, filter, or dynamically display matching data, Excel provides multiple ways to create an efficient search box.
In this guide, we will explain various methods, including Conditional Formatting, Advanced Filter, the FILTER function, and VBA Macros to create a filtering search box in excel.
Why Use a Filtering Search Box in Excel?
A search box in Excel allows users to:
- Quickly locate relevant information.
- Enhance data analysis by filtering records dynamically.
- Save time when dealing with large datasets.
- Improve data visualization by highlighting search results.
Method 1: Using Conditional Formatting for Search Highlighting
This method highlights matching cells instead of filtering them out, making it easier to see relevant data while keeping all records visible.
- Select a Search Cell: Choose a cell (e.g., A1) where users will enter the search term.
- Apply Conditional Formatting:
- Go to the Home tab.
- Click Conditional Formatting > New Rule.
- Choose Use a formula to determine which cells to format.
- Enter this formula:
=ISNUMBER(SEARCH($A$1, B2))
(Assuming B2 is the first cell in the column you want to search) - Click Format, choose a highlight color, and click OK.
- Test the Search Box: Enter a keyword in A1, and matching values will be highlighted.
- Apply Formatting Across the Entire Column: Drag down the formatting across your dataset.
Advantages of Conditional Formatting Method:
- Keeps all data visible while highlighting matches.
- Easy to implement without modifying data.
- Works well for quick visual identification of search results.
Method 2: Using Advanced Filter for Search Box
The Advanced Filter feature allows you to filter data dynamically based on a search input.
- Set Up the Search Criteria:
- Choose a cell for the search term (e.g., C1).
- Below it, enter the column header (e.g., “Name” in C2).
- In C3, enter
=C1
to reference the search term.
- Apply Advanced Filter:
- Click anywhere inside your dataset.
- Go to the Data tab and select Advanced under the Sort & Filter group.
- In the dialog box, set:
- List range to the dataset range (e.g., A2:A100).
- Criteria range to C2:C3.
- Click OK to filter the dataset based on the search input.
Cell | Content |
---|---|
C1 | Search Term |
C2 | Name |
C3 | =C1 |
Advantages of Advanced Filter Method:
- Works well for structured data.
- Allows filtering without permanently changing the dataset.
- Provides an option for copying results to another location.
Method 3: Using the FILTER Function (Excel 2019 & Later)
The FILTER function dynamically displays results matching the search term.
- Set Up the Search Box:
- Choose a cell (e.g., E1) for entering the search term.
- Enter the FILTER Formula:
- Select an empty cell where you want to display the filtered results (e.g., G2).
- Enter the following formula:
=FILTER(A2:D100, ISNUMBER(SEARCH(E1, A2:A100)), "No matches found")
(Assuming A2:D100 is your dataset, and E1 is the search box) - Press Enter and see filtered results update dynamically.
Search Box (E1) | Filtered Results (G2:G100) |
---|---|
Type a keyword | Dynamically filtered data |
Advantages of FILTER Function Method:
- Fully dynamic filtering.
- No need to manually update filters.
- Works well for large datasets with frequent updates.
Method 4: Creating a Dynamic Search Box with VBA Macros
For a more interactive search box, VBA Macros allow real-time filtering.
1) Enable Developer Tab:
- Go to File > Options > Customize Ribbon.
- Check the Developer option.
2) Insert a Text Box:
- Click Developer > Insert > Text Box (ActiveX Control).
- Place the text box on your sheet.
- Right-click and choose Properties, then link it to a cell (e.g., F1).
3) Write VBA Code to Filter Data:
- Press ALT + F11 to open VBA Editor.
- Click Insert > Module and enter this code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("F1")) Is Nothing Then
Dim searchTerm As String
searchTerm = Me.Range("F1").Value
If searchTerm <> "" Then
Me.Range("A2:D100").AutoFilter Field:=1, Criteria1:="*" & searchTerm & "*"
Else
Me.Range("A2:D100").AutoFilter
End If
End If
End Sub
- Save as Macro-Enabled Workbook (.xlsm).
- Test the search box in cell F1.
VBA Search Box (F1) | Filtered Results |
---|---|
Type a keyword | Data filters dynamically |
Advantages of VBA Macros Method:
- Allows real-time filtering.
- Provides advanced customization options.
- Ideal for large and interactive datasets.
Which Method Should You Use?
Method | Best For |
---|---|
Conditional Formatting | Highlighting matching values |
Advanced Filter | Manual filtering of search results |
FILTER Function | Dynamic filtering without VBA |
VBA Macros | Real-time interactive search box |
Final Thoughts
A filtering search box in Excel can improve data analysis and productivity. Depending on your needs, you can choose from Conditional Formatting, Advanced Filter, FILTER Function, or VBA Macros. Each method provides a unique way to search and filter data effectively, making Excel more powerful for managing large datasets. Choosing the right method depends on your Excel version, dataset size, and required level of automation.
Frequently Asked Questions
How do I create a simple search box in Excel?
You can create a simple search box in Excel using the FILTER function (Excel 2019 & later), Conditional Formatting, or Advanced Filter. These methods allow you to highlight or filter data based on a keyword entered in a specified cell.
Can I create a dynamic search box in Excel without VBA?
Yes, you can use the FILTER function in Excel 2019 and later to create a dynamic search box that updates results automatically based on user input.
What is the best way to highlight search results in Excel?
The best way to highlight search results in Excel is by using Conditional Formatting. This method allows you to automatically apply formatting (such as color highlights) to cells that match your search criteria.
How do I use VBA to filter search results in Excel?
To filter search results dynamically using VBA, you need to create a macro that listens for changes in a search cell and applies the AutoFilter function to your dataset. This enables real-time filtering.
Can I use a search box to filter multiple columns in Excel?
Yes, you can modify the FILTER function or VBA script to filter data across multiple columns based on a single search input.
Which Excel versions support the FILTER function?
The FILTER function is available in Excel 2019 and Microsoft 365. If you use an older version, you can achieve similar functionality using Advanced Filter or VBA Macros.

Vaishvi Desai is the founder of Excelsamurai and a passionate Excel enthusiast with years of experience in data analysis and spreadsheet management. With a mission to help others harness the power of Excel, Vaishvi shares her expertise through concise, easy-to-follow tutorials on shortcuts, formulas, Pivot Tables, and VBA.