Excel: Data validations with dynamic range from separate worksheet

℡╲_俬逩灬. 提交于 2021-01-29 00:16:50

问题


I am trying to create a data validation list whose source comes from a dynamic range on another worksheet. For instance, take the following layout

0 | A             B             C
--|-----------------------------------
1 | Category      Item          Price
2 | Dairy         Milk          $ 2.00
3 |               Bread         $ 3.00
4 | Fruit         Apple         $ 0.60
5 |               Bannana       $ 0.75

When I select Fruit from the first drop down list on another sheet, I would like to be able to select either Apple or Bannana from the second. Furthermore, if I later add a Vegetable category with Carrot and Squash, as well as another item to Fruit, I would like those items to dynamically become part of my data validation selections.

Is this possible without VBA? I would like to keep this "cell formula" based so I don't have to write a Application.Volatile function.


回答1:


Yes you can. You have to use a defined name as the source of the validation range, using the well know OFFSET() trick.



来源:https://stackoverflow.com/questions/7678703/excel-data-validations-with-dynamic-range-from-separate-worksheet

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