Excel数组查找公式 [英] Excel Array Lookup Formula

查看:276
本文介绍了Excel数组查找公式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有如下两个表。对于公式,假设ID1是单元格A1和表之间有一个空行,以便ID是对细胞A4。

  ID1 ID2 ID3 ID4 ID_OF_MAXDATE
A B D#N / A formula_here身份证号
一个1/1/2015
b 2015年1月2日
Ë2015年1月3日
ð2015年1月4日
摹2015年1月5日

在公式中,我想最大的日期,如果ID的该行中的ID。因此,在这种情况下,出一个,B,D的 - 最大日期为d与2015年1月4日。所以,我希望公式输出D。

我有以下迄今为止但#N / A抛出其关闭。无N / A值,下面的输出最大的日期。不过,我想最大日期的ID。它应该忽略N / A的范围内。请注意,所有的ID在表1将显示在表2。但是,在表1一些内径柱可以是N / A

  = MAX(IF(A2:D2 = A7:A11,B7:B11))


解决方案

一个更大和复杂的公式比预期的

,但它会考虑到的日期可以在数据集中出现多次。请务必与 CTRL + SHIFT +输入ENTER

<$p$p><$c$c>=IF(SUM(IFERROR(MATCH(A2:D2,$A$6:$A$10,0),\"\"))>0,LOOKUP(REPT(\"Z\",255),IF(MAX(IF(FREQUENCY(IFERROR(MATCH(TRANSPOSE(A2:D2),$A$6:$A$10,0),\"\"),ROW($B$6:$B$10)-ROW($B$6)+1),$B$6:$B$10))=IF(FREQUENCY(IFERROR(MATCH(TRANSPOSE(A2:D2),$A$6:$A$10,0),0),ROW($B$6:$B$10)-ROW($B$6)+1),$B$6:$B$10),$A$6:$A$10)),\"No匹配找到)

我也把一些额外的错误处理。该公式将返回没有找到匹配,如果它不能找到一个匹配。

在这里输入的形象描述

I have two tables as below. For formulas, assume "ID1" is on cell A1 and one blank row between tables so "ID" is on cell A4.

ID1  ID2  ID3  ID4     ID_OF_MAXDATE
a    b    d    #N/A    formula_here

ID     DATE
a      1/1/2015
b      1/2/2015
e      1/3/2015
d      1/4/2015
g      1/5/2015

In the formula, I want the id of the max date if id's in that row. So in this case, out of a,b,d - the max date is d with 1/4/2015. So the I want the formula to output d.

I have the below so far but the #N/A throws it off. Without the N/A value, the below outputs the max date. However, I want the ID of the max date. And it should ignore N/A's in the range. Note, all ID's in table 1 will appear in table 2. But some id columns in table 1 may be N/A.

=MAX(IF(A2:D2=A7:A11,B7:B11))

解决方案

A much bigger and complex formula than expected, but it will take into account that a date can appear more than once in the data set. Be sure and enter with CTRL + SHIFT + ENTER.

=IF(SUM(IFERROR(MATCH(A2:D2,$A$6:$A$10,0),""))>0,LOOKUP(REPT("Z",255),IF(MAX(IF(FREQUENCY(IFERROR(MATCH(TRANSPOSE(A2:D2),$A$6:$A$10,0),""),ROW($B$6:$B$10)-ROW($B$6)+1),$B$6:$B$10))=IF(FREQUENCY(IFERROR(MATCH(TRANSPOSE(A2:D2),$A$6:$A$10,0),0),ROW($B$6:$B$10)-ROW($B$6)+1),$B$6:$B$10),$A$6:$A$10)),"No Match Found")

I also put in some additional error handling. The formula will return "No Match Found" if it is unable to find a match.

这篇关于Excel数组查找公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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