简体   繁体   English

Excel - 多行的动态数据验证列表

[英]Excel - dynamic data validation lists for multiple rows

Excel 16.x for Mac Excel 16.x 适用于 Mac

I have a situation where we have a tabular spreadsheet template for requisitions.我有一种情况,我们有一个用于请购单的表格电子表格模板。 The spreadsheet is copied for each project and filled out.为每个项目复制并填写电子表格。 Each spreadsheet will have multiple rows - from 1-400.每个电子表格将有多行 - 从 1-400。 Each row has columns with data validation rules.每行都有带有数据验证规则的列。

The issue is that I cannot figure out how to enter a formula that generates a different list for each row the data validation formula entry.问题是我无法弄清楚如何输入一个为数据验证公式条目的每一行生成不同列表的公式。

eg: Each row will have a "Facility Code" and a "Building Code".例如:每一行都有一个“设施代码”和一个“建筑代码”。 The "Building Code" list is generated by what is in the "Facility Code" cell. “建筑代码”列表由“设施代码”单元格中的内容生成。 The problem is that the data validation rule wants a range of cells, not a formula that generates an array.问题是数据验证规则需要一系列单元格,而不是生成数组的公式。 With sometimes 400 rows, I would need to create 400 different lookups based on the R(n):Facility_Code entry.有时有 400 行,我需要根据 R(n):Facility_Code 条目创建 400 个不同的查找。

Dynamic List for Facility Code (in Template:P4), =UNIQUE(FILTER(NFS_Facilities[Facility Code],(NFS_Facilities[Facility Code]<>""),""))设施代码动态列表(在模板:P4 中),=UNIQUE(FILTER(NFS_Facilities[设施代码],(NFS_Facilities[设施代码]<>""),""))

Dynamic List for Building Code: =UNIQUE(FILTER(NFS_Facilities[Facility Code],(NFS_Facilities[Facility Code]='Template',P4),""))建筑规范动态列表:=UNIQUE(FILTER(NFS_Facilities[Facility Code],(NFS_Facilities[Facility Code]='Template',P4),""))

The P4 is the issue here as it will change by the row. P4 是这里的问题,因为它将逐行更改。

The Data List validation points to a range of cells.数据列表验证指向一系列单元格。

The current behavior is on R1, it works fine.当前行为在 R1 上,它工作正常。 On R2, no matter what is entered into "P5", it generates the data based on P4 (as it should as that is what is in the formula).在 R2 上,无论在“P5”中输入什么,它都会根据 P4 生成数据(公式中应该是这样)。

Is there any way to have the Data Validation formula be dynamic based on the R(n)?有什么方法可以让数据验证公式基于 R(n) 动态变化? The intent is to have the Data Validation range be a dynamic formula replacing P4 with tableName[facilityCode]目的是让数据验证范围成为一个动态公式,用 tableName[facilityCode] 替换 P4

...Ignore my previous answer. ...忽略我之前的回答。

Putting a FILTER isn't going to work inside a DV with a dynamic reference for some reason.由于某种原因,将 FILTER 放入具有动态参考的 DV 中是行不通的。

You'll need a hidden sheet, and in that sheet each row on the input sheet will have a corresponding row of options.您需要一个隐藏的工作表,在该工作表中,输入工作表上的每一行都有对应的选项行。 They key is to use =TRANSPOSE() around the FILTER() to make the results in rows not columns (so they don't cause #SPILL. errors.他们的关键是在 FILTER() 周围使用 =TRANSPOSE() 使结果以行而不是列的形式出现(因此它们不会导致 #SPILL. 错误。

Once you have that setup, just point the DV to the sheet with a spill reference (with a # behind it): example in Sheet BUILD_CODE_OPTIONS:A4:完成该设置后,只需将 DV 指向带有溢出参考(后面有#)的工作表:工作表 BUILD_CODE_OPTIONS:A4 中的示例:

=TRANSPOSE(UNIQUE(FILTER(NFS_Facilities[Facility Code],(NFS_Facilities[Facility Code]='Template'!P4),"")))

then in the DV for the Building Code field on row 4:然后在第 4 行建筑规范字段的 DV 中:

BUILD_CODE_OPTIONS!A4#

You'll need a sheet for every column you want a dynamic drop down in.对于要动态下拉的每一列,您都需要一张工作表。

... now just waiting for MS to fix the bug preventing the FILTER in the DV... ...现在只是等待 MS 修复阻止 DV 中的 FILTER 的错误...

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

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