简体   繁体   English

使用偏移量的Excel数据验证

[英]Excel Data Validation using Offset

The range that i am wanting to place into my data validation is the following: 我要放入数据验证的范围如下:

 =Offset(task_tbl,,G3-1,I3)

where: 哪里:

 task_tbl - Data Table
 G3 = Column number of the data Table to search from
 I3 is the number of rows in that column which contain information

I am not sure why this is not working because When i try this formula external from the Data Validation (ie in the excel sheet) and use the array function it returns the list perfectly. 我不确定为什么这行不通,因为当我在数据验证外部(即在Excel工作表中)尝试此公式并使用数组函数时,它会完美返回列表。

If anyone has any suggestions i would greatly appreciate it. 如果有人有任何建议,我将不胜感激。

Well it is possible as this mini example is meant to show using this custom formula:- 好吧,这是可能的,因为这个迷你示例旨在使用此自定义公式进行显示:-

=MATCH(G2,INDIRECT("Table1["&INDEX(INDIRECT("Table1[#Headers]"),$G$1)&"]"),0)

so it looks up the appropriate column name in the table headers then gives you the whole column with that name as the header. 因此它将在表标题中查找适当的列名称,然后为您提供以该名称为标题的整个列。 G1 selects the column and G2 is the cell we are trying to validate. G1选择列,而G2是我们要验证的单元格。

在此处输入图片说明

This also works as a drop-down list using this formula:- 也可以使用以下公式作为下拉列表:-

=INDIRECT("Table1["&INDEX(INDIRECT("Table1[#Headers]"),$G$1)&"]")

This offset formula also worked perfectly for me with the same table, 1,2 or 3 in G1, 3 in I3 and task_tbl defined as $A$2:- 这个偏移量公式对我来说也非常适合同一个表,在G1中为1,2或3,在I3中为3,将task_tbl定义为$ A $ 2:-

=OFFSET(task_tbl,,$G$1-1,$I$3)

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

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