MATCH or VLOOKUP starting from the end of the range

故事扮演 提交于 2019-12-01 17:24:29

问题


I have a table that looks like this

 A      B    
ID1  data 123
ID2  data 234
ID1  data 456
ID2  data 567

I am trying to find the best way to retrieve data 567 for ID2. Using MATCH (with option 0) or VLOOKUP (with option FALSE) on ID2 gives me access to the first record but I want to retrieve the last record.

I am using Excel 2010.

ps: I'd rather not use VBA or manipulate the data (sorting...).


回答1:


With data in A1:B4 and D1="ID2", try entering in E1:

=LOOKUP(2,1/(A1:A4=D1),B1:B4)

Note: LOOKUP returns the last value if the lookup value is larger than any of the values in the lookup range. Any errors are ignored.




回答2:


I know the question is already answered, but if any one is interested, here is the formula for a multiple criteria backwards lookup. =LOOKUP(2,1/(--(A1:A4=D1)*--(C1:C4=D2)),B1:B4)



来源:https://stackoverflow.com/questions/9588286/match-or-vlookup-starting-from-the-end-of-the-range

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!