[英]How to return an array where a column matches a value
I am trying to create the column _Type_below which return the type value for a matching name AND a matching interval.我正在尝试创建列 _Type_below,它返回匹配名称和匹配间隔的类型值。 I know I can use VLOOKUP for individual names, but lets say I have thousands of names and I can specify an array for VLOOKUP for all of them.我知道我可以将 VLOOKUP 用于单个名称,但是假设我有数千个名称,并且我可以为所有名称指定一个 VLOOKUP 数组。 Cheers!!干杯!!
Name position _Type_ Name Range_From Range_To Type
bob 0 A bob 0 30 A
bob 5 A bob 30 100 B
bob 10 A doug 0 40 C
bob 15 A doug 40 200 A
bob 20 A
bob 30 B
bob 40 B
bob 80 B
doug 0 C
doug 20 C
doug 40 A
...
If yu have the dynamic array formula you can use FILTER():如果你有动态数组公式,你可以使用 FILTER():
=VLOOKUP(B2,FILTER(E:G,A2=D:D),3)
If not then your data must be sorted on D then E:如果不是,那么您的数据必须按 D 排序,然后按 E:
=VLOOKUP(B2,INDEX(E:E,MATCH(A2,D:D,0)):INDEX(G:G,MATCH(A2,D:D,0)+COUNTIF(D:D,A2)-1),3)
This should be relatively quick, but it requires the data sorted.这应该相对较快,但它需要对数据进行排序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.