View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pete_UK Pete_UK is offline
external usenet poster
 
Posts: 8,856
Default How can I combine data from two sheets where field contents match?

Use VLOOKUP. In G2 of the main sheet enter this formula:

=VLOOKUP(A2,Sheet2!A$2:F$1000,3,0)

this assumes that you have 1000 records in Sheet2 (doesn't matter if
you have less) and that the data is in columns A to F - adjust as
necessary. The Part# has to be in the left-most column of the table
(I've assumed column A), and I've assumed that the value you want to
be returned is in the third column of this table (i.e. column C in
Sheet2).

The way the formula works is to try to find an exact match between A2
of Sheet1 in A2:A1000 of Sheet2. If there is a match, then the formula
returns the value from the 3rd column of the table in Sheet2. If there
is no match then the formula will return #N/A - to avoid this use this
variation:

=IF(ISNA(VLOOKUP(A2,Sheet2!A$2:F$1000,3,0)),"",VLO OKUP(A2,Sheet2!A$2:F
$1000,3,0))

this will give you a blank cell if there is no match (or you can
change the "" to some message , like "none").

Copy the formula down for as many items as you have in Sheet1. You can
use a similar formula to get other data from Sheet2 - all you need to
do is change the third parameter of the VLOOKUP from a 3 to the column
number that you want to return the data from.

Hope this helps.

Pete

On Jul 6, 8:30 pm, amaries wrote:
I have two sheets in same workbook, first one is a list of parts with lots of
other data (product code, qty, etc) In the second sheet I have a list of
parts with other data (#times quoted, qty, etc) I need to get the data from
sheet two to appear on sheet one where the part numer is the same.
So my first sheet will pull in the additional data on the parts from the
second sheet.
So like a link but where the part number matches.
Sheet 1
a)Part#
b)ProductCode
c)Qty on sales orders
d)Avg Sell Price
e)Qty on work orders
f)Avg Cost
g) (from sheet 2) Qty on quotes
h) (from sheet 2) Avg. Quote Price
I have use paste special but I couldn't figure out how to only merge where a
field content matched.
Any tips to accomplish this (under time constraint, CEO wants by EODay).
Thanks for any help