如何返回一个列与值匹配的数组 [英] How to return an array where a column matches a value

查看:112
本文介绍了如何返回一个列与值匹配的数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建_Type_below列,该列返回匹配名称和匹配间隔的类型值.我知道我可以为单个名称使用VLOOKUP,但是可以说我有成千上万个名称,并且可以为所有这些名称指定一个VLOOKUP数组.干杯!

I am trying to create the column _Type_below which return the type value for a matching name AND a matching interval. 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. 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
...       

推荐答案

如果您有动态数组公式,则可以使用FILTER():

If yu have the dynamic array formula you can use FILTER():

 =VLOOKUP(B2,FILTER(E:G,A2=D:D),3)

如果没有,那么您的数据必须先按D再按E排序:

If not then your data must be sorted on D then 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.

这篇关于如何返回一个列与值匹配的数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆