简体   繁体   English

excel:查找一个键的范围,找到多个匹配项,返回最后一个匹配项

[英]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.

相关问题 Excel 是否可以根据有多个匹配项的唯一键查找记录的数据,但根据条件仅返回一条记录? - 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中执行查找以返回多个列和行多个匹配项? - How to perform lookup to return multiple columns and rows multiple matches in excel? Excel索引匹配日期范围并返回匹配的总和 - Excel Index Match Date range and return SUM of matches 如何在 Excel 的 MMULT 查找中找到最后一个匹配项? - How can I find the LAST match in a MMULT lookup in Excel? MS Excel查找以匹配范围 - MS Excel Lookup to match a range Excel总和范围匹配查询 - Excel Sum Range Match Lookup Excel-查找以在日期范围之间返回多个值 - Excel - Lookup to return multiple values in between date range Excel 索引匹配以从多个匹配项中返回最低值 - Excel index match to return laegest value from multiple matches Excel:在进行部分匹配时在单个单元格中返回多个匹配项 - Excel: Return multiple matches in a single cell while doing a partial match Excel Match Multiple Criteria Lookup Array:从列表中查找包含所有值的列,并返回数组中的列 position - Excel Match Multiple Criteria Lookup Array: Find columns that contains all values from a list and return the columns position in the array
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM