Searchable drop down list excel vba

For a drop-down list with many values, finding a suitable value from the list is not an easy work. We have previously introduced a method to auto-complete a drop-down list when the first letter is entered. In addition to the autocomplete function, you can also make the drop down list searchable to improve the efficiency of finding the appropriate value in the drop down list. In order to make the drop-down list searchable, you can follow the methods below step by step.

Create a searchable drop down list in Excel
Easily create a searchable drop down list with an amazing tool

More tutorials for drop down list...

Create a searchable drop down list in Excel

Suppose you have a list of country names in column A as shown in the screenshot below, and now you want to use them as the source data of the searchale drop-down lists, you can do as follows to get it done.

You need to insert a Combo box instead of a data validation drop-down list in your worksheet.

1. If the Developer tab does not display on the ribbon, you can enable the Developer tab as follows.

1]. In Excel 2010 or later versions, click File > Options. And in the Excel Options dialog box, click Customize Ribbon in the left pane. Go to the Customize the Ribbon list box, check the Developer box, and then click the OK button. See screenshot:

2]. In Excel 2007, click Office button > Excel Options. In the Excel Options dialog box, click Popular in the left pane, check the Show Developer tab in the Ribbon box, and finally click the OK button.

2. After showing the Developer tab, click Developer > Insert > Combo box

3. Draw a Combo box in the worksheet, right click it and then select Properties from the right-clicking menu.

4. In the Properties dialog box, you need to:

1]. Select False in the AutoWordSelect field;

2]. Specify a cell in the LinkedCell field. In this case, we enter A12;

3]. Select 2-fmMatchEntryNone in the MatchEntry field;

4]. Type DropDownList into the ListFillRange field;

5]. Close the Properties dialog box. See screenshot:

5. Now turn off the design mode by clicking Developer > Design Mode.

6. Select a blank cell such as C2, enter the formula below and press Enter. They drag its AutoFill Handle down to cell C9 to auto fill the cells with the same formula. See screenshot:

=--ISNUMBER[IFERROR[SEARCH[$A$12,A2,1],""]]

Notes:

1. $A$12 is the cell that you have specified it as the LinkedCell in step 4;

2. After finishing the above steps, you can now test:  enter a letter C in the combo box, and then you can see that the formula cells that reference the cells containing the character C are filled with the number 1.

7. Select the cell D2, enter the formula below and press Enter. Then drag its AutoFill Handle down to the cell D9.

=IF[C2=1,COUNTIF[$C$2:C2,1],""]

8. Select cell E2, enter the formula below and press Enter. Then drag its AutoFill Handle down to E9 to apply the same formula.

=IFERROR[INDEX[$A$2:$A$9,MATCH[ROWS[$D$2:D2],$D$2:$D$9,0]],""]

9. Now you need to create a name range. Please click Formula > Define Name.

10. In the New Name dialog box, type DropDownList in the Name box, enter the formula below in the Refers to box, and then click the OK button.

=$E$2:INDEX[$E$2:$E$9,MAX[$D$2:$D$9],1]

11. Now, turn on the design mode by clicking Developer > Design Mode. Then double click the Combo box to open the Microsoft Visual Basic for Applications window.

12. Copy and paste the VBA code below into the Code editor.

VBA code: make drop down list searchable

Private Sub ComboBox1_GotFocus[] ComboBox1.ListFillRange = "DropDownList" Me.ComboBox1.DropDown End Sub

13. Press the Alt + Q keys to close the Microsoft Visual Basic for Applications window.

From now on, when a character is entered in the combo box, it will do a fuzzy search and then list the relevant values in the list.

Note: You need to save this workbook as an Excel Macro-Enabled Workbook file in order to keep the VBA code for future use.

Easily create a searchable drop down list with an amazing tool

It seems that the above method is not easy to handle. Here recommend a handy feature - Searchable drop-down List of Kutools for Excel to help easily create a searchable drop-down list in Excel.

Before applying Kutools for Excel, please download and install it firstly.

Please do as follows to create a searchable drop-down list with the Searchable drop-down List feature.

1. Click Kutools > Drop-down List > Searchable Drop-down List > Enable Searchable Drop-down List.

2. In the opening Kutools for Excel dialog box [this dialog only pops up the first time you apply this feature], click the Yes button.

3. Then in the Searchable Drop-down List dialog box, you need to configure as follows.

3.1] In the Apply to section, you can specify the range scope for applying this feature:

A: Specified Range[s]: Support one or more drop-down list ranges;

B: Specified Scope: Support Current worksheet, Current workbook or All workbooks.

3.2] In the Options section, there are two options, you can choose one of them, both of them or neither of them according to your needs:

A: Matches only the beginning of the word: If this option is checked, only the items that begin with the typed character are displayed, meanwhile, the first displayed item will be autocompleted; If this option is unchecked, items that contain the typed character will be displayed;

B: Case sensitive: If this option is checked, only the items match the case of the typed character are displayed; If this option is unchecked, items that containing the typed character will be displayed without case sensitive.

3.3] In the Mode section, choose the mode for adding drop-down list items to cells.

A: Append: If you choose this radio button, multiple searched items [including duplicates] will be allowed to be added to a cell. After adding the first searched item to a cell, if you perform a new search in that cell again, the new searched item will be added to the end of the existing one.

In the Separator text box, enter a separator to separate the added items;

In the Text Direction section, choose a direction to display the added items in the drop-down list cell.

B: Modify: If you choose this radio button, the later added item will overwrite the existing one. Only one item is allowed to be displayed in the cell at a time.

4. Then click Kutools > Drop-down List > Searchable Drop-down List > Enable Searchable Drop-down List to enable this feature.

Now the searchable drop-down list has been created. When clicking on a drop-down list cell, a list box will pop up with all drop-down items listed. Enter a character and the corresponding items will be searched out at once, and you can click the needed item to insert it into that cell.

If you chose Horizontally in the Text Direction section: all added items will be displayed horizontally in a cell. See the below demo:

If you chose Vertically in the Text Direction section: all added items will be displayed vertically in a cell. See the below demo:

If you chose the Modify radio button, only one item is allowed to be displayed in a drop-down list cell at a time. See the below demo:

Click to know more about this feature.

  If you want to have a free trial [ 30-day] of this utility, please click to download it, and then go to apply the operation according above steps.

Related articles:

Autocomplete when typing in Excel drop down list
If you have a data validation drop down list with large values, you need to scroll down in the list just for finding the proper one, or type the whole word into the list box directly. If there is method for allowing to auto complete when typing the first letter in the drop down list, everything will become easier. This tutorial provides the method to solve the problem.

Create drop down list from another workbook in Excel
It is quite easy to create a data validation drop down list among worksheets within a workbook. But if the list data you need for the data validation locates in another workbook, what would you do? In this tutorial, you will learn how to create a drop fown list from another workbook in Excel in details.

Create a searchable drop down list in Excel
For a drop down list with numerous values, finding a proper one is not an easy work. Previously we have introduced a method of auto completing drop down list when enter the first letter into the drop down box. Besides the autocomplete function, you can also make the drop down list searchable for enhancing the working efficiency in finding proper values in the drop down list. For making drop down list searchable, try the method in this tutorial.

Auto populate other cells when selecting values in Excel drop down list
Let’s say you have created a drop down list based on the values in cell range B8:B14. When you selecting any value in the drop down list, you want the corresponding values in cell range C8:C14 be automatically populated in a selected cell. For solving the problem, the methods in this tutorial will do you a favor.

More tutorial for drop down list...

Video liên quan

Chủ Đề