Excel Dependent drop down list anwsers

匿名 (未验证) 提交于 2019-12-03 01:45:01

问题:

I have multiple drop down list that are dependent on each other and depending on which answers you choose i would like other lists to be determined. I will try to explain structure below

**Position**      **Fruit**            **Location**    **Thing**         1                Banana                 Mexico        TV  2                Apple                  New York      hat  3                Orange                 Tokyo         pen  4                grape                  Canada        bed                                          London        box                                          Home 

So for example a dependency is if you select 'Banana' from 'Fruit' you are only going to be able to select certain options from Location, and Thing list.

What i want to accomplish is something like this :

if you choose '1' from position; position => '1' your only options from fruit would be banana, apple.

Fruit => Banana, Apple.  if position = 1( fruit = banana, apple) 

But if you choose '2' from position; position => '2' everything would be available from Fruit. But then if you choose '2' then Banana, only Canada from 'location' would be available from another cell.

If position:2 => fruit:banana => Location = Canada If position: 2 => fruit:apple => Location can equal Mexico, New York, Tokyo 

I have defined names in a data sheet, one problem i ran into is that defined names cannot start with numbers. and for some answers i absolutely need numbers.

I started writing a foruma but syntax and logic are not correct.

=VLOOKUP($c4,if ($c4 = "<1",VLOOKUP($c4,MasterList,2,FALSE), IF ($C4= "2"($c4,MasterList,3,FALSE). 

c4 in this case would be the initial drop down question.

How can i make this possible?

回答1:

Dynamic named ranges using index():index() functions can work. Though, the data needs to be structured in such a way to facilitate it. For example, fruit list for position 1 would need to be:

   A           B         Fruit IndexKey  |  Value    1      |  Banana    1      |  Apple   ...     |   ... 

With cell c4 as the input, you can create the named range Fruits:

=Index(Sheet2!$B:$B,Match(Sheet1!$C$4,Sheet2!$A:$A,0)):Index(Sheet2!$B:$B,Countif(Sheet2!$A:$A,Sheet1!$C$4)+Match(Sheet1!$C$4,Sheet2!$A:$A,0)-1) 

Where Sheet2 is the data and Sheet1 is the input field sheet.

Then, you can set a validation list to the Fruits named range for the next validation list. Each named range can keep relying on the selection from the previous selection.

The important thing is to keep the indexkey columns sorted because of how match works.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!