View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.newusers
JLatham JLatham is offline
external usenet poster
 
Posts: 2,203
Default How do I match records from two Sheets?

I may have misunderstood your request. The code above will find entries on
sheet 2 that are MISSING from sheet 1 and add them to the list on sheet 1.

You seem to want something that matches the records and brings over data to
sheet 1 that doesn't yet exist.

You can do that with a VLOOKUP formula rather than with code. Assuming your
records on both sheets go from column A over to column G and the codes are in
column A on both sheets, then beginning at row 2 (column B) you could enter
this formula:
=VLOOKUP($A2,'Sheet2'!$A$2:$G$1070,2,FALSE)
and that will bring up matching data from column 2 of Sheet2 to Sheet1, then
in
Sheet1, C2 enter this:
=VLOOKUP($A2,'Sheet2'!$A$2:$G$1070,3,FALSE)
as you can see, it's the same formula, just changing the ,2, to ,3, Repeat
the copying of the formula across to column G (or where ever your records
end) changing the ,2, (or ,3,) to the next increasing value to get different
column information from Sheet2. Then copy the formulas down the sheet to the
end of the data on Sheet1.



"sebastico" wrote:

Excel 2003

Sheet1 has one column with 904 records (alphanumeric)
Sheet2 has one column with 1069 records (alphanumeric)
Both fields have same format (17 characters)

I need a code to read each record in sheet 1, then go to sheet 2 and read
the records, if the record is found then copy the record from sheet2 and
paste it in sheet1 next to the record. Do the same with all records in sheet2.