Lookup a value that matches a key in one column th

2020-01-29 21:42发布

问题:

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.