简体   繁体   English

Excel中的分层动态下拉列表

[英]Hierarchial dynamic dropdown list in Excel

In my firm, I've a database like this and I want to create a hierarchical dynamically updating drop down list. 在我的公司,我有一个像这样的数据库,我想创建一个分层动态更新下拉列表。

+-----------+----------+--------+
| Institute | Industry | Course |
+-----------+----------+--------+
| a         | aa       | aaa    |
| a         | aa       | bbb    |
| b         | bb       | mmm    |
| b         | cc       | ddd    |
| b         | bb       | ttt    |
| c         | ee       | fff    |
| d         | ee       | ggg    |
+-----------+----------+--------+


I want the end result to be something like this. 我希望最终结果是这样的。 The user will start from the top. 用户将从顶部开始。 Depending on top entry bottom list will change accordingly. 根据顶部条目,底部列表将相应更改。 Below is a snapshot. 以下是快照。

My User Entry List Demo Structure 我的用户条目列表演示结构


My Approach 我的方法

My plan was to create an array formula which indexes the course list based on the first two entry. 我的计划是创建一个数组公式,根据前两个条目索引课程列表。 Then use offset to take the course entries. 然后使用offset来获取课程条目。 But my problem is though I am able to index the course list I am not able to sort them to use in data validation. 但我的问题是,虽然我能够索引课程列表,但我无法对它们进行排序以用于数据验证。 And data validation does not ignore the non-filled or error values, which I don't want. 数据验证不会忽略我不想要的非填充或错误值。 Assuming I solved the first hierarchy problem and I've the Institute and Industry output. 假设我解决了第一个层次结构问题,我就是研究所和行业的输出。 I tried this 我试过这个

G8 - Institute Input from drop down G8 - 来自下拉列表的研究所输入
G9 - Industry Input from drop down G9 - 来自下拉列表的行业输入
H11:H15 - respective courses H11:H15 - 各自的课程

And the formula in H11:H15 is {=INDEX(C2:C8,1/(1/((A2:A8=G8)*(B2:B8=H8)*(ROW(C2:C8)-1))))} H11:H15中的公式为{=INDEX(C2:C8,1/(1/((A2:A8=G8)*(B2:B8=H8)*(ROW(C2:C8)-1))))}
Here is the output I'm getting. 这是我得到的输出

I am fairly new to posting questions. 我很想发布问题。 Let me know if I can make it more clear. 如果我能说得更清楚,请告诉我。 Also, I found these very useful links while surfing the internet. 此外,我在上网时发现了这些非常有用的链接。 Pardon me for adding as code, as SO doesn't allow more than 2 links for new members 请原谅我添加代码,因为SO不允许新成员使用2个以上的链接

1: http://www.contextures.com/xlDataVal02.html
2: https://www.ablebits.com/office-addins-blog/2014/09/30/dependent-cascading-dropdown-lists-excel/

I think what you want is to put this formula as an array into H11:H18: 我想你想要的是把这个公式作为一个数组放入H11:H18:

=IFERROR(INDEX(C2:C8,AGGREGATE(15,6,(ROW(C2:C8)-1)/((A2:A8=G8)*(B2:B8=G9)),ROW()-ROW(H10)),1),"")

Then you can set your data validation for the course option to H11:H18. 然后,您可以将课程选项的数据验证设置为H11:H18。

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM