View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove Harlan Grove is offline
external usenet poster
 
Posts: 733
Default Combining worksheets with common column but different number of ro

Tony wrote...
I have two excel spreadsheets, one that is complete with product
part numbers, item descriptions, prices, quantity, photo url's, etc.
I get a daily update in the form of a spreadhseet with part number
and quantity only.

Is there a way that excel can recognize that column A in each
worksheet are part numbers, and if the part number in column A of
each worksheet matches that excel should update column G with the
new quantity (column B from worksheet 2)?

....

I'll assume these are separate files, which in Excel terminology are
workbooks. I'll also assume both are open. Further, I'll assume both
have their tables starting in cell A1 with headings in row 1, part
number in column A in both and quantity in column D of the first
workbook and column B of the second.

Would you want the existing values in worksheet 1 retained if there
were no corresponding part number in workbook 2? Or would you want to
show 0 or "" or "n/a"? Either way, use an additional column in the
first workbook to pull in data from the second workbook using a
VLOOKUP formula.

[FirstWorkbook.xls]FirstWorksheet!X2:
=IF(COUNT(MATCH(A2,[SecondWorkbook.xls]SecondWorksheet!$A:$A,0)),
VLOOKUP(A2,[SecondWorkbook.xls]SecondWorksheet!$A:$B,2,0),D2)

Fill X2 down as far as needed, then select X2:X#, copy, move to D2,
paste special as Values, then clear X2:X#.

The D2 as the third argument to IF in the formula above pulls in the
existing quantity value if there's no entry in the second workbook. If
you want to show 0, replace D2 with 0 before filling the formula down.
Similarly for any other value you'd want to use in place of the
existing quantity value.