Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
591 views
in Technique[技术] by (71.8m points)

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

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...