Creating a Search Box in Excel
The idea of creating a search box in excel, so that we keep writing the required data and accordingly it will filter the data and show only that much of data. In this article, we will show you how to create a search box and filter the data in excel.
15 Easy Steps to Create Dynamic Search Box in Excel
To create a dynamic search box in excel. we are going to use the below data. You can download the workbook and follow along with us to create it on your own.
Follow the below steps to create a dynamic search box in excel.
- Step 1: First create a unique list of “City” names by removing duplicates in a new worksheet.
- Step 2: For this unique list of cities give a name as “CityList”
- Step 3: Go to the Developer tab in excel and from the insert, box inserts “Combo Box”.
- Step 4: Draw this “Combo” box on your worksheet where the data is in.
- Step 5: Right-click on this “Combo Box” and choose the “Properties” option.
- Step 6: This will open up properties options like the below one.
- Step 7: We have several properties here, for the property “Linked Cell” gives a link to the cell D2.
- Step 8: For “List Fill Range” property give the name given to a unique list of “Cities”.
- Step 9: For “Match Entry” property choose 2-fmMatchEntryNone because as you type the name in the combo box it will not auto-complete the sentence.
- Step 10: We are done with properties part of “Combo Box”. Go to the “Developer” tab and unselect the “Design” mode option of “Combo Box”.
- Step 11: Now from the combo box we can see city names in the drop-down list in excel.
In fact, we can type the name inside the combo box and the same will reflect inlined cell D2 as well.
4.9 (1,353 ratings) 35+ Courses | 120+ Hours | Full Lifetime Access | Certificate of Completion
- Step 12: Now we need to write formulas to filter the data as we type the city name in the combo box. For this, we need to have three helper columns, for the first helper column we need to find the row numbers by using ROWS function.
- Step 13: In the second helper column we need to find the related searches city names and if they match we need the row numbers of those cities for this to enter the below formula.
This formula will look for the city name in the main table if matches it will return the row number from the “Helper 1” column or else will return empty cell.
For example, now I will type “Los Angeles” and wherever the city name is there in the main table for those cities we will get the row number.
- Step 14: Once the row numbers of entered or selected city name is available we need to stick together these row numbers one under the other, so in the third helper column we need to stack all these row numbers of entered city name.
This formula will look for the smallest value in the matched city list based on actual row numbers and it will stack the first smallest, second smallest, third smallest and so on. Once all the small values are stacked together SMALL function throw an error value, so to avoid this we have used the IFERROR function and if the error value comes it will return an empty cell as a result.
- Step 15: Now create an identical table format like the below one.
In this new table, we need to filter the data based on the city name we type in the excel search box. This can be done by using a combination of IFERROR, INDEX, and COLUMNS functions in excel. Below is the formula you need to apply.
Copy the formula and paste to all the other cells in the new table.
Ok, we are done with designing part, let’s learn how to use it.
Type the city name in the combo box and our new table will filter the entered city data only.
As you can see I just typed just “LO” and all the related search result is filtered in the new table format.
Things to Remember here
- You need to insert a combo box in excel from “ActiveX Form Control” under the “Developer” tab.
- Combo box matches all the related alphabets returns the result.
This has been a guide to the search box in excel. Here we discuss how to create a dynamic search box in excel along with an example and downloadable excel templates. You may also look at these useful functions in excel –