Combine Sheet Data

J

JR

Hello,
Need help with a macro. I have a work book with two sheets. Both sheets have
the same layout and are sorted by column A, by part number. The only main
difference is sheet two has one extra column which is a UPC code. I need to
be able to take this column and add it to sheet one and match to the same
item number in column A. I need it to post to sheet one, column G. UPC code
on sheet two is in column H.

Thanks for the help
JR
 
D

Dave Peterson

You could avoid a macro and just use a formula:

=vlookup(a1,sheet2!a:h,8,0)
or if there's a chance for no matching item number:
=IF(ISERROR(VLOOKUP(A1,Sheet2!A:H,8,0)),"Missing",VLOOKUP(A1,Sheet2!A:H,8,0))
 
J

JR

Hello,
Thank you for the advice. I have never setup vlookup? Is this inserted in
the cell?

Thanks JR
 
J

JR

Hello,
I inserted =vlookup(a1,sheet2!a:h,8,0) in colum H of sheet one, but it does
not want to pull info from sheet 2 column H?

Thanks JR

JR said:
Hello,
Thank you for the advice. I have never setup vlookup? Is this inserted in
the cell?

Thanks JR
 
O

Otto Moehrbach

Is your "Sheet2" actually named "Sheet2" on the tab? That formula will work
with only a sheet that is named "Sheet2". HTH Otto
JR said:
Hello,
I inserted =vlookup(a1,sheet2!a:h,8,0) in colum H of sheet one, but it
does not want to pull info from sheet 2 column H?

Thanks JR
 
D

Dave Peterson

You may want to read Debra Dalgleish's notes:
http://www.contextures.com/xlFunctions02.html (for =vlookup())

This formula looks for a match between A1 of the current sheet and column A of
Sheet2.

If there is no match, then you get an error message.

If Otto's suggestion doesn't help, you may want to post more details.

The name of the worksheet with the table and the cell's address that will
contain the formula and what cell's address to match up.
Hello,
I inserted =vlookup(a1,sheet2!a:h,8,0) in colum H of sheet one, but it does
not want to pull info from sheet 2 column H?

Thanks JR
 
J

JR

Hello,
Yes, Sheet1 is Sheet1 and Sheet2 is Sheet2. If I am correct, this formula is
inserted into sheet1, column H1 and copied down, correct?

Thanks JR
 
Top