donkeykong
donkeykong

Reputation: 11

Loop through range, if match copy specific cell

I have this formula that is working, it looks into a value and if there is a match between the sheets then it prints out what row the match is in. But what I would like it to do is that If match if found then copy value from column B in the same row as the value is found.

So if match is found between A2 in sheet1 and range A:A in sheet2, and lets say the row is 5, I want it to copy B5. Is this possible?

=IF(ISERROR(MATCH(A1;Indata!A:A;0));"";  MATCH(A1;Sheet2!A:A;0))

Upvotes: 1

Views: 159

Answers (1)

Abe Gold
Abe Gold

Reputation: 2347

=IF(ISERROR(MATCH(A1,Sheet2!A:A,0)),"",INDEX(Sheet2!B:B,MATCH(A1,Sheet2!A:A,0)))

Upvotes: 1

Related Questions