0

I'm attempting to look up a value from one column, and if found, copy the corresponding cell in a second column to new cell.

Column B is a list of names Column M is another list of names, which is also found in Column B, and this list has an ID # associated to it in column L.

what I want to do is is the following; If value in B2 is found in column M, then copy the adjacent cell in L, to column A beside the name looked up.

One note about the names in Column M, they are a little off but can be matched by grab X number of characters in the cell in column B.

So far I've come up with the following:

 =INDEX($L$1:$L$130,SMALL(IF(ISNUMBER(SEARCH(LEFT($B2,10),$M$1:$M$130)),MATCH(ROW($M$1:$M$130),ROW($M$1:$M$130))),ROW(A1)))

Thoughts or suggestions.. If there is a better way I'm game. I found the above searching Google and working on this yesterday. I'm not sure I fully under stand the ROW(A1) at the end

Thanks.

4

2 に答える 2

1

The simplest solution would be to move or copy column L to the right of column M and do a simple lookup. For example, if you copied column L to column N, the formula in cell A2 would be:

=IFERROR(VLOOKUP(LEFT(B2,10),$M$1:$N130,2,0),"-")

If you needed to move the helper column further to the right, you would just need to widen the lookup range to include that column, and adjust the index number (here, 2) to return that column.

If you cannot, or don't want, to move column L or make a copy of it to the right of column N, this formula would work:

=IFERROR(INDEX($L$1:$L$130,MATCH(LEFT(B2,10),$M$1:$M$130,0)),"-")

You will see that I have wrapped both of the formulas in IFERROR to handle non-matches.

As BarryHoudini notes in his comment, if the value in cell B2 does not match with the complete values in cells M1:M130, i.e., if the values in those cells have additional characters after the first 10, then the LEFT(B2,10) in the above formulas should be changed to LEFT(B2,10)&"*".

于 2013-01-23T19:14:48.913 に答える
1

This should do the job:

=INDEX($L:$L,MATCH(LEFT($B2,10),$M:$M,0))
于 2013-01-23T19:15:03.563 に答える