excel中二级下拉列表_Excel中的条件下拉列表

excel中二级下拉列表

It’s fairly easy to make one drop down list show items based on what was selected in another drop down. But what about making a third drop down list? And how can you work with spaces, or other characters that can’t be used in Excel names?

使一个下拉列表根据另一个下拉列表中的选择来显示项目相当容易。 但是如何制作第三个下拉列表呢? 以及如何使用空格或Excel名称中不能使用的其他字符?

Here is a nice, simple conditional list – if you select Red Fruit in cell A2, you can see a list of red fruit in cell B2.

这是一个很好的简单条件列表–如果在单元格A2中选择“红色水果”,则可以在单元格B2中看到红色水果的列表。

dependentdropdownspace01

使用命名范围 (Using Named Ranges)

There is a named range on the worksheet – RedFruit – and the data validation formula uses the INDIRECT function to create a reference to that range. The formula also removes any spaces in the text, by using the SUBSTITUTE function, because the range names can’t use space characters.

工作表上有一个命名范围-RedFruit-且数据验证公式使用INDIRECT函数创建对该范围的引用。 该公式还使用SUBSTITUTE函数删除了文本中的所有空格,因为范围名称不能使用空格字符。

=INDIRECT(SUBSTITUTE(A2," ",""))

= INDIRECT(SUBSTITUTE(A2,“”,“”))

dependentdropdownspace02

复杂列表的查找表 (Lookup Tables for Complex Lists)

It’s simple to use the SUBSTITUTE function to get rid of any spaces, but your list of items might contain other characters that can’t be used in range names, such as an ampersand (&) or asterisk (*).

使用SUBSTITUTE函数删除任何空格很简单,但是您的项目列表可能包含范围名称中不能使用的其他字符,例如&符(&)或星号(*)。

Instead of trying to substitute every illegal character, you can set up a lookup table. Put the list items in the first column, and a short code for each item in the second column. The range with items and codes is named ProductLookup.

您可以设置查找表,而不是尝试替换每个非法字符。 将列表项放在第一栏中,将每个项目的简短代码放在第二栏中。 包含项目和代码的范围称为ProductLookup。

The data validation formula will look in that list, to find the code, and show the items from a list with that name. In this example, all the list names end with “List”, so that is added in the formula.

数据验证公式将在该列表中查找,以找到代码,并显示具有该名称的列表中的项目。 在此示例中,所有列表名称都以“ List”结尾,因此将其添加到公式中。

=INDIRECT(VLOOKUP(A2,ProductLookup,2,0)&"List")

= INDIRECT(VLOOKUP(A2,ProductLookup,2,0)&“ List”)

dependentdropdownillegal06

添加第三个从属下拉列表 (Add a Third Dependent Drop Down)

You could even add a third drop down list that is dependent on the selections in the first two.

您甚至可以添加第三个下拉列表,该列表取决于前两个中的选择。

dependentdropdownillegal01

Just create a lookup table for each of the secondary lists, and an item list for each of those secondary codes.

只需为每个辅助列表创建一个查找表,并为每个辅助代码创建一个项目列表。

dependentdropdownillegal02

Here is the data validation formula in cell C2

这是单元格C2中的数据验证公式

=INDIRECT(VLOOKUP(B2,INDIRECT(VLOOKUP(A2,ProductLookup,2,0)&"Lookup"),2,0)&"List")

= INDIRECT(VLOOKUP(B2,INDIRECT(VLOOKUP(A2,ProductLookup,2,0)&“ Lookup”),2,0)&“ List”)

It finds the product lookup table,

找到产品查找表,

  • VLOOKUP(A2,ProductLookup,2,0)&"Lookup"

    VLOOKUP(A2,ProductLookup,2,0)&“ Lookup”

the product code in that table,

该表中的产品代码,

  • VLOOKUP(B2,INDIRECT(VLOOKUP(A2,ProductLookup,2,0)&"Lookup"),2,0)

    VLOOKUP(B2,INDIRECT( VLOOKUP(A2,ProductLookup,2,0)&“ Lookup” ),2,0)

and adds “List” to create a reference to the list name.

并添加“列表”以创建对列表名称的引用。

=INDIRECT(VLOOKUP(B2,INDIRECT(VLOOKUP(A2,ProductLookup,2,0)&"Lookup"),2,0)&"List")

= INDIRECT( VLOOKUP(B2,INDIRECT( VLOOKUP(A2,ProductLookup,2,0)&“ Lookup” ),2,0) &“ List”)

下载样本文件 (Download the Sample File)

You can see the details on my Contextures website, Dependent Lists page, and download the sample file.

您可以在我的Contextures网站的“ 从属列表”页面上查看详细信息,并下载示例文件。

翻译自: https://contexturesblog.com/archives/2013/09/26/conditional-drop-down-lists-in-excel/

excel中二级下拉列表

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值