[英]Can Excel Lookup data for a record based on a unique key where there are multiple matches, but return only 1 record based on a condition?
[英]excel: lookup a range for a key, find multiple matches, return the last match
在下面的示例中,A列包含键,而B列包含值。
我想搜索键“ aaa”,并返回上一个匹配项的值:“ aug”。
在这种情况下,“ aaa”键有3个实例,但可能只有1个实例,或者有很多(未知)“ aaa”键。 我对最后一场比赛总是很感兴趣。
不能添加其他列。 列未排序。
vlookup()返回第一个匹配项(“ jan”),但我无法使其与其他函数结合使用以返回最后一个匹配项。
谢谢。
A B C ...
+-----+-----+
1 | aaa | jan |
+-----+-----+
2 | b | feb |
+-----+-----+
3 | c | mar |
+-----+-----+
4 | aaa | apr |
+-----+-----+
5 | d | jun |
+-----+-----+
6 | e | jul |
+-----+-----+
7 | aaa | aug |
+-----+-----+
8 | f | sep |
+-----+-----+
9 | g | oct |
+-----+-----+
=LOOKUP(1,0/(A1:A9="aaa"),B1:B9)
问候
请在下面写下数组公式。
=index(B1:B9, max(if(a1:a9="aaa", row(a1:a9))))
然后按Ctrl + Shift + Enter
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.