Excel 2010:如何在验证列表中使用自动完成功能
我正在使用一个大型验证列表,其中有几个 vlookup() 函数所依赖。这个名单变得越来越大。有没有办法输入我要查找的列表项的第一个字母,而不是手动向下滚动列表搜索该项目?
我做了一些谷歌搜索,但这表明这在早期版本的 Excel 中确实可行,但在 Excel 2010 中不行。希望你们能提供帮助。
I'm using a large validation list on which a couple of vlookup() functions depend. This list is getting larger and larger. Is there a way to type the first letters of the list item I'm looking for, instead of manually scrolling down the list searching for the item?
I've done some Googling but this suggests that this is indeed possible in earlier versions of Excel, but not in Excel 2010. Hope you guys can help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
这是处理此问题的一个非常好的方法(可在 ozgrid 上找到):
让我们假设您的列表位于
Sheet2
上,并且您希望在Sheet1
上使用具有自动完成功能的验证列表。在
Sheet1
A1
上输入=Sheet2!A1
并向下复制,包括所需数量的备用行(假设总共 300 行)。隐藏这些行并在引用中使用此公式:对于名为 MyList 的动态命名范围:现在在最后一个隐藏行正下方的单元格中使用数据验证,对于列表源使用
=MyList
[编辑] Excel 2007+ 的改编版本(虽然无法在 2010 上进行测试,但据我所知,没有任何特定于版本的内容)。
假设您的数据源位于
Sheet2!A1:A300
上,并假设您的验证列表(又名自动完成)位于单元格Sheet1!A1
上。创建一个动态命名范围
MyList
,该范围取决于您放置验证的单元格的值=OFFSET(Sheet2!$A$1,MATCH(Sheet1!$A$1&"*",Sheet2!$A$1:$A$300,0)-1,0,COUNTA(Sheet2!$ A:$A))
在引用列表的单元格
Sheet1!A1
上添加验证列表=MyList
注意事项
这不是一个真实自动完成,因为您必须先输入,然后单击验证箭头:列表将在列表的第一个匹配元素处开始
列表将一直到数据末尾。如果您想更精确(仅在列表中保留匹配元素),您可以使用将计算的
SUMLPRODUCT
更改COUNTA
匹配元素的数量您的源列表必须已排序
Here is a very good way to handle this (found on ozgrid):
Let's say your list is on
Sheet2
and you wish to use the Validation List with AutoComplete onSheet1
.On
Sheet1
A1
Enter=Sheet2!A1
and copy down including as many spare rows as needed (say 300 rows total). Hide these rows and use this formula in the Refers to: for a dynamic named range called MyList:Now in the cell immediately below the last hidden row use Data Validation and for the List Source use
=MyList
[EDIT] Adapted version for Excel 2007+ (couldn't test on 2010 though but AFAIK, there is nothing really specific to a version).
Let's say your data source is on
Sheet2!A1:A300
and let's assume your validation list (aka autocomplete) is on cellSheet1!A1
.Create a dynamic named range
MyList
that will depend on the value of the cell where you put the validation=OFFSET(Sheet2!$A$1,MATCH(Sheet1!$A$1&"*",Sheet2!$A$1:$A$300,0)-1,0,COUNTA(Sheet2!$A:$A))
Add the validation list on cell
Sheet1!A1
that will refert to the list=MyList
Caveats
This is not a real autocomplete as you have to type first and then click on the validation arrow : the list will then begin at the first matching element of your list
The list will go till the end of your data. If you want to be more precise (keep in the list only the matching elements), you can change the
COUNTA
with aSUMLPRODUCT
that will calculate the number of matching elementsYour source list must be sorted
这是另一种选择。它的工作原理是将 ActiveX 组合框放在单元格顶部并启用验证,然后在组合框中提供自动完成功能。
Here's another option. It works by putting an ActiveX ComboBox on top of the cell with validation enabled, and then providing autocomplete in the ComboBox instead.
基于 JMax 的答案,将此公式用于动态命名范围以使解决方案适用于多行:
Building on the answer of JMax, use this formula for the dynamic named range to make the solution work for multiple rows:
只要有垂直列的项目,Excel 就会自动执行此操作。如果您选择列下方(或上方)的空白单元格并开始输入,它会根据列中的所有内容自动完成。
Excel automatically does this whenever you have a vertical column of items. If you select the blank cell below (or above) the column and start typing, it does autocomplete based on everything in the column.
正如其他人所建议的,您需要使用组合框。然而,大多数教程只向您展示如何设置一个组合框,并且该过程相当乏味。
由于我之前在从列表中输入大量数据时遇到过这个问题,我建议您使用 这个自动完成加载项。它可以帮助您在选择的任何单元格上创建组合框,并且您可以定义要显示在下拉列表中的列表。
As other people suggested, you need to use a combobox. However, most tutorials show you how to set up just one combobox and the process is quite tedious.
As I faced this problem before when entering a large amount of data from a list, I can suggest you use this autocomplete add-in . It helps you create the combobox on any cells you select and you can define a list to appear in the dropdown.
将工作表名称创建为
Namelist
。在 A 列中填写数据列表。创建另一个工作表名称为
FillData
,用于根据需要制作数据验证列表。输入第一个字母并选择,将根据您的输入显示下拉菜单。
Create sheet name as
Namelist
. In column A fill list of data.Create another sheet name as
FillData
for making data validation list as you want.Type first alphabet and select, drop down menu will appear depend on you type.