[英]excel: lookup a range for a key, find multiple matches, return the last match
In the example below the A column contains keys and the B column contains values. 在下面的示例中,A列包含键,而B列包含值。
I want to search for the key "aaa", and return the last match's value: "aug". 我想搜索键“ aaa”,并返回上一个匹配项的值:“ aug”。
In this case there are 3 instances of the "aaa" key, but there could be just 1 instance, or many (unknown) number of "aaa" keys. 在这种情况下,“ aaa”键有3个实例,但可能只有1个实例,或者有很多(未知)“ aaa”键。 I'm always interested in just the the last match.
我对最后一场比赛总是很感兴趣。
No additional columns can be added. 不能添加其他列。 The columns are not sorted.
列未排序。
vlookup() returns the first match ("jan") and I haven't been able to make it work in conjunction with other functions to return the last match. vlookup()返回第一个匹配项(“ jan”),但我无法使其与其他函数结合使用以返回最后一个匹配项。
Thanks. 谢谢。
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)
问候
Please write the array formula below. 请在下面写下数组公式。
=index(B1:B9, max(if(a1:a9="aaa", row(a1:a9))))
then press ctrl + shift + enter 然后按Ctrl + Shift + Enter
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.