作者:ala | 来源:互联网 | 2023-05-19 18:20
Ifinallyfiguredouthowtomakeadependentdropdown.FINALLY.我终于想出了如何使依赖性下拉。最后。Myproblemis
I finally figured out how to make a dependent drop down. FINALLY.
我终于想出了如何使依赖性下拉。最后。
My problem is when I change the first drop down, the second one still has the options from the first option.
我的问题是当我更改第一个下拉列表时,第二个下拉列表仍然具有第一个选项中的选项。
Drop down 1:
下拉1:
Fruit
Vegetables
Fruits Drop Down info: Apples
Bananas
水果下拉信息:苹果香蕉
Vegetables Drop Down info: Carrots
Cucumbers
蔬菜下拉信息:胡萝卜黄瓜
If I choose Fruit, I can choose Apples. However, if I choose Vegetables, Apples is still an option until I change it.
如果我选择水果,我可以选择苹果。但是,如果我选择蔬菜,苹果仍然是一个选择,直到我改变它。
Is there a solution to purge the second drop down every time a change is made on the first one?
每次在第一次更改时,是否有清除第二次下拉的解决方案?
I found: Dependent drop down list in excel auto update but I'm confused on how to make it work for my situation. Drop down is in A10 and secondary is A20. My next plan is to learn VBA.
我发现:excel自动更新中的依赖下拉列表但我对如何使其适用于我的情况感到困惑。跌落在A10,次要是A20。我的下一个计划是学习VBA。
2 个解决方案
0
In the second drop down, you can use formulas. If your fruit choices are in one column, and the vegetable choices are in another, you can do something like the following...
在第二个下拉列表中,您可以使用公式。如果您的水果选择在一列中,而蔬菜选择在另一列中,您可以执行以下操作...
Assuming that your Drop Down 1 is in A10, your list of Fruits is C1:C10, list of Vegetables is D1:D10:
假设您的Drop Down 1在A10中,您的水果列表是C1:C10,蔬菜列表是D1:D10:
For the second drop down in cell A20, go to Data Validation -> List. Instead of just choosing your list of either Fruits, or Vegetables, do this "=If(A10="Fruit",c1:c10,d1:d10)".
对于单元格A20中的第二个下拉列表,请转到数据验证 - >列表。不要只选择水果或蔬菜的列表,而是“= If(A10 =”Fruit“,c1:c10,d1:d10)”。
Then, as you change the A1 value from Fruits to Vegetables, your second drop down will update the list choices.
然后,当您将A1值从Fruits更改为Vegetables时,第二个下拉菜单将更新列表选项。
Edit: I don't know if you are going to be adding to those lists of fruits/vegetables, but you can also used named ranges. If you name all of your Fruit choices as, say, "Fruit", and vegetables as "Vegetables", the data validation can use these named ranges: "=If(A10="Fruit",Fruits,Vegetables)".
编辑:我不知道你是否要添加水果/蔬菜列表,但你也可以使用命名范围。如果您将所有Fruit选项命名为“Fruit”,将蔬菜命名为“Vegetables”,则数据验证可以使用这些命名范围:“= If(A10 =”Fruit“,Fruits,Vegetables)”。