Lookup a value that matches a key in one column then apply that as a key to return a value from a third column

余生长醉 提交于 2019-11-26 18:37:59

问题


I have values in columns G and N that have the same values, but not in the same order, so if column G and N matches, then return column L to column A. I am getting the wrong values from column L in column A.

What other information is needed besides formula below?

=IFERROR(VLOOKUP(N2,$G$2:$N$413,6,FALSE),"")  
Col a      Col b    Col G    Col L   Col M    Col N
    ID     CoID     Items    ItemsID ParentID Items1
    45     1        Apple    45      1        Apple

回答1:


Since you are trying to find the ColumnL value in the same row as you find the ColumnN value I’d suggest an INDEX MATCH combination – similar to VLOOKUP but more powerful (eg can ‘look to the left’, which VLOOKUP can’t).

=IFERROR(INDEX(L:L,MATCH(G2,N:N,0)),"") 

MATCH looks for the position where G2 is found in ColumnN so that is the row number for the ColumnL value you want returned.



来源:https://stackoverflow.com/questions/32468275/lookup-a-value-that-matches-a-key-in-one-column-then-apply-that-as-a-key-to-retu

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