IF A matches B copy C to D puzzle?

  • Hi All,


    So I can't get this to work, any help wold be very much appreciated from a excel newbie..


    My puzzle I'm trying to find a solution is below -


    If the values in column A Cell 'A13' of worksheet2 matches the values in column A Cell 'A19' of worksheet1 then copy the value of column B Cell 'B19' of worksheet1 to column C Cell "C13' in worksheet2.


    So basically if a name "john doe" in worksheet2, matches a name in worksheet1 "john doe", copy the adjacent cell back to the row in worksheet2 where "john doe" is, and paste it in column C


    Does anybody knows the code? Tried several things on Google, but I can't seem to find what I exactly need.


    Workbook attached


    Any help would be much appreciated


    Thanks

  • You don't need a macro. Put this in C2 of the Report sheet and copy down.


    =IFNA(VLOOKUP(A2,Sheet1!A1:B20,2,0),"")

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • You're welcome

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • You could use VLOOKUP (C2 and copy down)


    Code
    =IFERROR(VLOOKUP(A2,Sheet1!$A$1:$B$20,2,0),"")


    or INDEX/MATCH


    Code
    =IFERROR(INDEX(Sheet1!$B$1:$B$20,MATCH(Report!A2,Sheet1!$A$1:$A$20,0)),"")


    In both cases, the IFERROR will show a blank rather than NA error if the name is not found.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!