提示:其它语言是由 Google 机器翻译的。 你可以访问 English 版本。
登录
x
or
x
x
马上登记
x

or

如何在Excel中创建可搜索的下拉列表?

对于有许多值的下拉列表,找到合适的值不是一件容易的事情。 之前我们已经介绍了在下拉框中输入第一个字母时自动完成下拉列表的方法。 除了自动完成功能外,您还可以通过下拉列表搜索以提高在下拉列表中找到适当值的工作效率。 为了使下拉列表可搜索,请按照下面的步骤一步一步教程。

在Excel中创建一个可搜索的下拉列表


在所有打开的工作簿或某些工作表中轻松搜索(查找和替换)文本:

点击 Kutools > 菜单导航 > 查找和替换 快速搜索(查找和替换)Excel中所有打开的工作簿或某些工作表中的文本或值。 立即下载Kutools for Excel的全功能60天免费试用版!

Kutools for Excel:比200方便的Excel加载项,可以在60天免费试用。 立即下载免费试用版!

Office选项卡在Office中启用选项卡式编辑和浏览,使您的工作更轻松......
Kutools for Excel - 最佳办公生产力工具将解决您的大部分Excel问题
  • 重用任何东西: 将最常用或最复杂的公式,图表和其他任何内容添加到您的收藏夹中,并在将来快速重复使用它们。
  • 超过20文本功能: 从文本字符串中提取数字; 提取或删除部分文本; 将数字和货币转换为英语单词...
  • 合并工具:多个工作簿和表格合二为一; 合并多个单元格/行/列而不丢失数据; 合并重复行和总和...
  • 拆分工具:根据价值将数据拆分为多个表格; 一个工作簿到多个Excel,PDF或CSV文件; 一列到多列......
  • 粘贴跳过 隐藏/过滤行; 数和总和 按背景颜色; 创建邮件列表和 通过Cell的价值发送电子邮件...
  • 超级过滤器: 创建高级过滤方案并应用于任何工作表; 排序 按周,日,频率等; 筛选 通过大胆,公式,评论......
  • 超过300强大的功能; 适用于Office 2007-2019和365; 支持所有语言; 在公司轻松部署; 全功能60天免费试用。

在Excel中创建一个可搜索的下拉列表


例如,您需要用于下拉列表的源数据在范围A2:A9中。

此方法需要组合框而不是数据验证下拉列表。 要创建可搜索的下拉列表,请执行以下操作。

1。 如果你找不到 开发人员 功能区中的标签,请按以下步骤启用“开发人员”选项卡。

1)。 在Excel 2010和2013中,单击 文件 > 期权。 和在 期权 对话框,单击 自定义功能区 在右窗格中,检查 开发人员 框,然后单击 OK 按钮。 看截图:

2)。 在Outlook 2007中,单击 办公室 按钮> Excel选项。 在 Excel选项 对话框,单击 最火热 在右栏中,然后检查 在功能区显示开发人员选项卡 框,最后点击 OK 按钮。

2。 展示后 开发人员 标签,请点击 开发人员 > 插页 > 组合框。 看截图:

3。 在工作表中绘制组合框并右键单击它。 选择 楼盘 从右键菜单。

4。 在里面 楼盘 对话框中,您需要:

1)。 选择 AutoWordSelect 领域;

2)。 在中指定一个单元格 LinkedCell 领域。 在这种情况下,我们输入A12;

3)。 选择 2-fmMatchEntryNoneMatchEntry 领域;

4)。 类型 下拉列表列表填充范围 领域;

5)。 关上 楼盘 对话框。 看截图:

5。 现在点击关闭设计模式 开发人员 > 设计模式.

6。 选择一个空白单元格C2,然后复制并粘贴公式 = - ISNUMBER(IFERROR(SEARCH($ A $ 12,A2,1), “”)) 进入公式栏,然后按Enter键。 他们将其拖放到单元格C9以自动填充具有相同公式的选定单元格。 看截图:

笔记:

1。 $ A $ 12是您在步骤4的LinkedCell字段中指定的单元格;

2。 完成上述步骤后,现在可以对其进行测试。 在下拉框中输入一个字母C,你会看到所有包含C的单元格填充了数字1。

7。 选择单元格D2,把公式 = IF(C2 = 1,COUNTIF($ C $ 2:C2,1), “”) 进入公式栏,然后按Enter键。 然后将D2中的填充控制柄向下拖动到D9以填充范围D3:D9。

8。 选择单元格E2,复制并粘贴公式 =IFERROR(INDEX($A$2:$A$9,MATCH(ROWS($D$2:D2),$D$2:$D$9,0)),"") 进入公式栏并按Enter键。 然后将E2中的填充句柄拖到E9以填充单元格。 然后你会看到单元格填充如下面的截图所示。

9。 现在您需要创建一个名称范围。 请点击 公式 > 定义名称.

10。 在里面 新名字 对话框中输入 下拉列表名字 框中键入公式 =$E$2:INDEX($E$2:$E$9,MAX($D$2:$D$9),1) 框,然后单击 OK 按钮。

11。 现在,通过单击启用设计模式 开发人员 > 设计模式。 然后双击在步骤3中创建的组合框来打开 Microsoft Visual Basic for Applications 窗口。

12。 将下面的VBA代码复制并粘贴到代码编辑器中。

VBA代码:使下拉列表可搜索

Private Sub ComboBox1_GotFocus()
	ComboBox1.ListFillRange = "DropDownList"
	Me.ComboBox1.DropDown
End Sub

13。 关上 Microsoft Visual Basic for Applications 窗口。

从现在开始,当你开始在列表框中输入时,它将开始模糊搜索,并在下拉列表中列出相关值。

注意:关闭并重新打开工作表后,您在步骤12中创建的VBA代码将自动删除。 所以,您需要将此工作簿保存为Excel宏启用工作簿格式。


Office Tab - 在Excel中选项卡式浏览,编辑和管理工作簿:

Office选项卡将Web浏览器(如Google Chrome,Internet Explorer新版本和Firefox)中显示的选项卡界面带到Microsoft Excel。 它将是一个节省时间的工具,在您的工作中无可比拟。 见下面的演示:

点击免费试用Office Tab!

Excel的Office选项卡


相关文章:


Kutools for Excel - 最佳办公生产力工具提高80%的生产力

  • 重用: 快速插入 复杂的公式,图表 以及你以前用过的任何东西; 加密单元格 密码; 创建邮件列表 并发送电子邮件...
  • 超级方程式酒吧 (轻松编辑多行文字和公式); 阅读布局 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不丢失数据; 分裂细胞含量; 组合重复的行/列...防止重复的细胞; 比较范围...
  • 选择复制或唯一 行; 选择空行 (所有细胞都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择......
  • 精确复制 多个单元格而不更改公式参考; 自动创建参考 多张表; 插入项目符号,复选框等等......
  • 提取文本,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级过滤器 (将过滤方案保存并应用到其他工作表); 高级排序 按月/周/日,频率等; 特殊过滤器 用粗体,斜体......
  • 结合工作簿和工作表; 根据键列合并表; 将数据拆分为多个表格; 批量转换xls,xlsx和PDF...
  • 超过300强大的功能。 支持Office / Excel 2007-2019和365。 支持所有语言。 在您的企业或组织中轻松部署。 全功能60天免费试用。
kte tab 201905

Office选项卡为Office提供选项卡式界面,使您的工作更轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,Publisher,Access,Visio和Project。
  • 在同一窗口的新选项卡中打开并创建多个文档,而不是在新窗口中。
  • 通过50%提高您的工作效率,每天为您减少数百次鼠标点击!
官方底部
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    ismaeel ahmad · 9 days ago
    how to use this dropdown in vba form any konw please reply
  • To post as a guest, your comment is unpublished.
    Jeroen · 10 days ago
    Hi, I made an action list for internal use with automatic email reminders in Excel, based on macro and vba. in a cell you select which person to send the reminder to, in a next cell you select which person to CC etc. Is it a good idea to copy this dropdownlist a few 100 times to every possible entry that I supply ? And is it possible to add a rule: Per row a particular person can only be selected once?
  • To post as a guest, your comment is unpublished.
    Ajesh · 12 days ago
    I have around 80000 data while running excel is hang
  • To post as a guest, your comment is unpublished.
    Sourav Singha · 1 months ago
    Sir How to use this in excel userform combobox....? plz help
    • To post as a guest, your comment is unpublished.
      crystal · 1 months ago
      Hi Sourav Singha,
      Can't use it in a userform combobox. Sorry for the inconvenience.
  • To post as a guest, your comment is unpublished.
    Josh · 3 months ago
    Is there a way to make it call up a hyperlink? My email is joshuarobertdaniels@gmail.com
    • To post as a guest, your comment is unpublished.
      crystal · 1 months ago
      Hi Josh,
      Sorry can;t help you with that yet.
  • To post as a guest, your comment is unpublished.
    Vrezh · 4 months ago
    I have a problem. My list is in Armenian language, and I see ??????-s instead of the letters. how can I fix this problem? Thank you in advance
    • To post as a guest, your comment is unpublished.
      crystal · 3 months ago
      Hi Vrezh,
      Sorry this kind of problem can't be solved yet. Thank you for your comment.
  • To post as a guest, your comment is unpublished.
    Steve Olah · 7 months ago
    How can I use this? I have two problem
    1st I would like use ComboBox1 for a full column, so I have D column, it should see empty.
    When I click into a cell in D column example D7 or D8(etc) I should get a Combo in D7 or D8 etc cell and after select just see the result, not the combo too.

    But how can I add combobox dynamically to D2, D4, D11 etc when click or before.
    I need for I can search with typing too, so simple(not active-x) combo is wrong.

    2nd how set padding? - my combo text when I search is not see whole because itt has padding.

    3th if my source is C column, how drop empty elements from list
  • To post as a guest, your comment is unpublished.
    sigidapurnomo purnomo · 10 months ago
    I had try tutorial drodown list searchable, Some like that,. But i'am can't make searcable from list and Combo Box Search??? How to make VBA Macro Connected in Excel??
  • To post as a guest, your comment is unpublished.
    Mubashir · 1 years ago
    I want to make this drop down to work for whole column, so that with multiple entries, I have this search suggestion option available every time. Above option, just shows suggestion for one time. Please help
  • To post as a guest, your comment is unpublished.
    Min · 1 years ago
    Hi. I get many helps from your post. However, it doesn't make automatic dropdown if there are mixed language on the list (e.g: first cell is written in English, second cell is written in Korean etc.) Has anyone had solve this problem?
  • To post as a guest, your comment is unpublished.
    dan · 1 years ago
    The automatic dropdown list is not working. Everything else is working. Do you know where my snag might lie?
    • To post as a guest, your comment is unpublished.
      dan · 1 years ago
      I figured it my be with the last step. I put the VBA code in my personal.xlsb worksheet but looks like the code needs to be on the sheet of the respective workbook. hazah
  • To post as a guest, your comment is unpublished.
    michael cianci · 1 years ago
    I got this to work but for some reason excel crashes if i attempt to use the arrows to select things from the drop down. has anyone had this issue? is it even supposed to be possible?
    thanks
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Dear Michael,
      The problem you mentioned does not appear in my case. Which Office version do you use?
      • To post as a guest, your comment is unpublished.
        yogi · 1 years ago
        Dear Crystal,

        I got the same problem as michael does, excel crashes every time i use down arrow in the drop box, i got excel 2010 on my laptop, which version do you use?
        • To post as a guest, your comment is unpublished.
          crystal · 1 years ago
          Hi yogi,
          The method has been successfully tested in Office 2010, 2013 as well as 2016. No idea for this problem. Sorry about that.
  • To post as a guest, your comment is unpublished.
    alluxxx · 1 years ago
    Is there a way to prioritize the location of a letter in a word? I used this method, but when I type in "A," for example, I get terms with "A" anywhere in the word. I would prefer if it started showing all the terms that begin with "A". Is this possible?
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Hi,
      Sorry for reply so late. If you want to search values in drop-down list that begin with a certain character, please change the formula in column C to
      =--ISNUMBER(IFERROR(SEARCH($A$12,MID(A3,1,1),1),"")).
      Thank you for your comment.
  • To post as a guest, your comment is unpublished.
    KATHLEEN · 1 years ago
    I may have misunderstood how this function is supposed to work, but i can only get the combo box search to populate one cell, A12 (using the example from the tutorial). If i click into A13 to populate the next cell with a different value from the drop down, it just replaces what i have in A12 and does not populate A13. I need this search to apply to any cell in column A from A12 down. Have i done something incorrect or does this combo box search only allow a single cell in the workbook to be populated with the result? Will be grateful for any help with this.
  • To post as a guest, your comment is unpublished.
    Kathleen · 1 years ago
    I may have misunderstood how this function is supposed to work, but i can only get the combo box search to populate one cell, A12 (using the example from the tutorial). If i click into A13 to populate the next cell with a different value from the drop down, it just replaces what i have in A12 and does not populate A13. I need this search to apply to any cell in column A from A12 down. Have i done something incorrect or does this combo box search only allow a single cell in the workbook to be populated with the result? Will be grateful for any help with this.
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Good Day,
      This combo box search only allow a single cell in the workbook to be populated with the result.
      I'll try to find another method to solve your problem.
  • To post as a guest, your comment is unpublished.
    Ben Johnston · 1 years ago
    I feel dumb, but immediately after posting, I realized I probably hadn't added the 1 to DropDownList1 in the VBA, and sure enough that was the problem! Thanks anyway!
  • To post as a guest, your comment is unpublished.
    Ben Johnston · 1 years ago
    Hello, thanks for the tutorial! I'm having an issue where every time I type in the combo box, "DropDownList1" disappears from the "ListFillRange" property. So long as I don't type in the box, if I retype "DropDownList1" in the property, the box does show suggestions. I have looked everything over and could not find any errors. Is this a common problem, and is there a way to fix it? Thank you for your time!
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Dear Ben,
      I am also comfusing about the disappearing of the "DripDownList" from the "ListFillRange" property
      But it does not influence the finally rsult of making the drop-down list seachable.
  • To post as a guest, your comment is unpublished.
    dave · 1 years ago
    is there a way to have the search box put the top result if left blank? in the case of this example it would automatically put china if it was left blank
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Dear dave,
      Would you please provide a screenshot of your spreadsheet showing what you are exactly trying to do?
  • To post as a guest, your comment is unpublished.
    Al B · 2 years ago
    I've had an ongoing issue with all documents I've used this method on. A shadow of the drop-down box reappears underneath it each time I click into another cell within the spreadsheet and begin typing. It's beyond just a nuisance because when the shadow drops down, it prevents use of any additional searchable drop-down boxes. Please help!!! This is affecting multiple documents we use throughout our organization.
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Good day,
      Sorry for replying so late. The problem you methoded does not appear in my case.Would be nice if you could provide your Office verson. Thank you!
  • To post as a guest, your comment is unpublished.
    Gunawan Budianto · 2 years ago
    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;

    Why A12? thank's
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Hi,
      This cell is optionally selected which can help to finish the whole operation. You can choose any one as you need.
  • To post as a guest, your comment is unpublished.
    Jelbin · 2 years ago
    Hi As in forum,
    I need to have this searchable dropdown for columns 2 to 500. Please let me know how i can as the second combo replicates the same in first which i dont want
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Dear Jelbin,
      Can't handle this. Sorry about that.
  • To post as a guest, your comment is unpublished.
    Havocknox · 2 years ago
    Thank you for this breakdown to make the combo box searchable. I have even gotten three of them working on the same page. My problem I have run into is when I start typing in the search information and the info narrows down, if I hit the down arrow key to select the item in the list Excel crashes on me. Has anyone had this happen, and if so have you found a way to solve this issue.
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Hi,
      The problemm you mentioned does not appear in my case. Would you please provide your Office version?
  • To post as a guest, your comment is unpublished.
    Heric · 2 years ago
    Hi,

    your guide is most helpful, but i still encounter one last problem.
    I am trying to do a simple invoice, and do the drop down for my customer name cell, must my customer listing be in the same worksheet as my invoice worksheet? Is is possible i have two worksheet, "invoice" & "customer name", and do the drop down list for customer name at "invoice" worksheet?

    Thank you
  • To post as a guest, your comment is unpublished.
    Jaydie · 2 years ago
    Thank you, I used above and it works perfectly....

    Until you have two combo boxes in one sheet.. When you want to type in the second combo box it highlights the text in the first combo box and does not want to search
    If I leave the first box blank, the second box works fine

    Please help
  • To post as a guest, your comment is unpublished.
    NAJMA · 2 years ago
    plz help me
    i cannt enter formula in formula bar
    when i paste this formula & paste this =--ISNUMBER(IFERROR(SEARCH($A$12,A2,1),""))
    give me error.type :(
  • To post as a guest, your comment is unpublished.
    Ashok · 2 years ago
    HI, How to do the same searchable program for contnious rwo , i tried and it is working one row only , i want to do the same for below row also for different name
  • To post as a guest, your comment is unpublished.
    Ahmed Shahin · 2 years ago
    Hi Herb,

    What if i created a drop down list from another work sheet? the formula " =--ISNUMBER(IFERROR(SEARCH($A$2,H2,1),""))" has wrong reference and when i edit it it doesn't allow to put the right cell. what do you suggest? thank you
  • To post as a guest, your comment is unpublished.
    Yesenia · 2 years ago
    I, like Cristina above, would also like to know how to make multiple combo boxes for one sheet. I tried but when I begin typing in the second combobox two things happen: 1. no drop down list appears, and 2. the simple act of typing in combobox2 activates the selection from my original combobox1 and highlights it in the drop down from combobox1. I checked to make sure all of my coding says combobox2 for combobox2 etc. for the other boxes but there is a disconnect that I can't figure out.
    • To post as a guest, your comment is unpublished.
      Jaydie · 2 years ago
      I have the exact same problem, have you managed a solution yet??
  • To post as a guest, your comment is unpublished.
    FAUZI · 3 years ago
    Thank You.. Very helpfull.. God Bless You
  • To post as a guest, your comment is unpublished.
    Maarten · 3 years ago
    Hi,

    I can't fill in 'DropDownList' in the 'ListFillRange'.... What's the catch? I don't understand the solution of imad.
    Thanks.
    • To post as a guest, your comment is unpublished.
      Herb123987 · 3 years ago
      [quote name="Maarten"]Hi,

      I can't fill in 'DropDownList' in the 'ListFillRange'.... What's the catch? I don't understand the solution of imad.
      Thanks.[/quote]

      I posted this answer above for IMAD and saw this posting down here for MAARTEN so I figured I'd post this for him too.

      I have seen this "how to make an autofill / auto suggest DDL / combo box" on a few different sites and they ALL want you to put "something" in the ListFillRange Properties field [b]BEFORE[/b] they have you [b]create a named range[/b] by clicking Formula > Define Name ....... and the [b]ListFillRange will always go blank in the Properties window[/b] UNTIL you define the name (Formula > Define Name)

      THAT is why i think IMAD, above and MAARTEN below (here) was having the problem - not 100% sure though.
      • To post as a guest, your comment is unpublished.
        Maarten · 3 years ago
        Hi there,

        Thanks a lot for your solution. I gave up already, but I'll try again.
    • To post as a guest, your comment is unpublished.
      Andone · 3 years ago
      try to put this=--ISNUMBER(IFERROR(SEARCH($A$12,$A$2,1),"")) instead =--ISNUMBER(IFERROR(SEARCH($A$12,A2,1),"")) in step 6
  • To post as a guest, your comment is unpublished.
    imad · 3 years ago
    So I Finally got it to work! I attached the linkedcell to a vlookup and got all the information pulling into a row. I was wondering if there could be any extension on the vba to actually filter the table as we type?
  • To post as a guest, your comment is unpublished.
    imad · 3 years ago
    Mine isn't working. My dropdownlist label was not working in the "properties" for the combobox. Everytime I entered it, it disappeared. So I used "test" instead. I adjusted the macro with the word test instead of dropdowmlist. Let me know if there is something else I can do? Search not working.
    • To post as a guest, your comment is unpublished.
      Herb123987 · 3 years ago
      [quote name="imad"]Mine isn't working. My dropdownlist label was not working in the "properties" for the combobox. Everytime I entered it, it disappeared. So I used "test" instead. I adjusted the macro with the word test instead of dropdowmlist. Let me know if there is something else I can do? Search not working.[/quote]

      I have seen this "how to make an autofill / auto suggest DDL / combo box" on a few different sites and they ALL want you to put "something" in the ListFillRange field BEFORE they have you create a name range by clicking Formula > Define Name and the ListFillRange will always go blank in the Properties window UNTIL you define the name (Formula > Define Name)

      THAT is why i think IMAD, above and MAARTEN below was having the problem - not 100% sure though.
  • To post as a guest, your comment is unpublished.
    MarkC · 3 years ago
    For some reason when I click a selection from the drop down list after typing a few characters the drop down main value becomes blank... any idea why this would happen and how to get it to stop?

    I have a command button that I want to click to then put the selection into the next available cell in a given range, but again the value blanks out when I click on it.
    • To post as a guest, your comment is unpublished.
      imad · 3 years ago
      I have the exact same problem. I did everything right but the dropdownlist label just goes blank everytime I press enter. If you figured it out, please do share!
  • To post as a guest, your comment is unpublished.
    Cristina · 4 years ago
    Excellent post. Could you please explain how do you copy the same drop down list to multiple cells. I want to create an expense report and I want to be able to select a different expense on each row from the same drop down list. Thank you.
  • To post as a guest, your comment is unpublished.
    Prastuti · 4 years ago
    very nicely explained. Loved it. Thank you !!