简体   繁体   English

Excel Index Match Formula最后更改

[英]Excel Index Match Formula last change

I've got a column U and a column L . 我有U列和L列。
What I need to get is the value from column L when searched in column U. 我需要获取的是在U列中搜索时L列中的值。

    Column L          Column U  
      516               11  
      123               11   
      74                5  
      46                11
      748               21  
      156               11  
      189               21
      187               21

For example: 例如:
I want to search 21 in column U but I need to find the first value from the last change 我想在U列中搜索21,但是我需要从最后一次更改中找到第一个值
(the number stays the same further in the column). (该数字在此列中保持不变)。
So if I want the value belonging to 21 I need to get 189. 因此,如果我想要属于21的值,则需要获得189。

I tried it with (thanks to Scott Craner): 我尝试过(感谢Scott Craner):
=INDEX($L:$L,AGGREGATE(14,6,ROW($U$10:$U$500)/($U$10:$U$500=D2),1))
But this gets me the last 21 value so 187 as answer. 但这使我得到最后的21个值,所以187为答案。

Does anybody know how to solve this? 有人知道如何解决这个问题吗?

If I understand you correctly, I believe this accomplishes the task: 如果我对您的理解正确,我相信这可以完成任务:

=INDEX($L:$L,MATCH(INDEX($L:$L,AGGREGATE(14,6,ROW($U$9:INDIRECT("$U$"&MATCH(INDEX($L:$L,AGGREGATE(14,6,ROW($U$10:$U$500)/($U$10:$U$500=D2),1)),$L:$L,0)))/($U$9:INDIRECT("$U$"&MATCH(INDEX($L:$L,AGGREGATE(14,6,ROW($U$10:$U$500)/($U$10:$U$500=D2),1)),$L:$L,0))<>D2),1)),$L:$L,0)+1)

It builds on Scott's concept, and finds the 187, then limits the search arrays to the row where it finds 187, and finds the last row that does not have the number you are searching for (21). 它建立在Scott的概念上,找到187,然后将搜索数​​组限制为找到187的行,然后找到没有您要搜索的数字的最后一行(21)。 Then it indexes the first row after that, which will be the first match in the last series. 然后,它索引之后的第一行,这将是最后一个系列中的第一个匹配项。

在此处输入图片说明

You need to find the last row in column U with the value from D2 where the row immediately above it is not the same value. 您需要使用D2中的值查找U列中的最后一行,而紧接其上方的行不是同一值。

=INDEX(L:L, AGGREGATE(14,6,ROW(U$10:U$500)/((U$10:U$500=D2)*(U$9:U$499<>D2)),1))

在此处输入图片说明

Now change U15 to be another 21. The result becomes, 现在将U15更改为另一个21。结果变为

在此处输入图片说明

For a dynamic number of values in columns L and U (starting in row 10), use, 要获取L和U列中的动态值(从第10行开始),请使用,

=INDEX(L:L, AGGREGATE(14,6,ROW(U$10:INDEX(U:U, MATCH(1E+99, U:U)))/((U$10:INDEX(U:U, MATCH(1E+99, U:U))=D2)*(U$9:INDEX(U:U, MATCH(1E+99, U:U)-1)<>D2)),1))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM