Excel中的动态数据验证(非VBA!) [英] Dynamic Data Validation in Excel (Non-VBA!)
问题描述
我得到了 n
个类别,其中包含 m
个产品。此列表未排序,例如:
I got n
Categories which hold m
Products. This list is unsorted, for example like this:
现在,我基本上要使用此列表:
Now here's what I basically want to do with this list:
-
Dropdown:数据验证,该数据动态存储第一列的每个唯一值的列表(=我将无法选择Category_5,因为它尚不存在)。
Dropdown: Data validation which dynamically stores a list of each unique value of the first column (= I won't be able to select Category_5 since it does not exist yet).
下拉列表:根据第一个下拉列表中的所选类别提供所有产品的列表。
Dropdown: Provide a list of all products based on the selected category in the first Dropdown.
是否有任何非VBA解决方案
Is there any non-VBA solution for this?
推荐答案
电子表格布局示例:
-
A2:A13
-类别列表,项目不是唯一的 -
B2:B13
-产品列表 -
单元格D2
向下-下拉列表1来源,唯一项,动态 -
Ce ll F2
-下拉列表2项增量编号1 ..(公式中的计算较少) -
单元格G2
下-动态下拉列表2来源 -
单元格I2
-下拉单元格1 -
单元格J2
-下拉单元格2
A2:A13
- Category list, the items are not uniqueB2:B13
- Product listCell D2
down - Dropdown list 1 source, unique items, dynamicCell F2
down - Dropdown list 2 item incremental number 1.. (less calculations in the formula)Cell G2
down - Dropdown list 2 source, dynamicCell I2
- Dropdown cell 1Cell J2
- Dropdown cell 2
单元格 D2
:数组公式( Ctrl - Shift - Enter 从公式窗口输入,插入大括号Excel,而不是用户),向下复制:
Cell D2
: array formula (Ctrl-Shift-Enter from formula window to enter, curled brackets are inserted by Excel, not by a user), copied downwards:
{=INDEX($A$2:$A$13;MATCH(0;COUNTIF($D$1:D1;$A$2:$A$13);0))}
给出唯一的类别列表。
单元格 G2
:数组公式,请按照上一节中的说明进行操作:
Cell G2
: array formula, follow instructions in the previous section:
{=INDEX($B:$B;SMALL(IF($A$2:$A$13=$I$2;ROW($A$2:$A$13);"");$F2))}
在 I2
单元格中所选类别下的产品列表。
Gives a list of products under a category selected in cell I2
.
未对列表进行排序:最好按类别和产品对初始列表进行排序。
没有错误处理:应使用 IF ISERROR <来更新公式/ code>子句。
The lists are not sorted: better to sort the initial lists by category and product.
No error handling: the formulae should be updated with IF ISERROR
clause.
这篇关于Excel中的动态数据验证(非VBA!)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!