View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Pete_UK
 
Posts: n/a
Default merging spreadsheets

Do you have the same number of rows in both sheets, and is there an
entry in both sheets for each unique value? Is the 16,804 rows the
total number, or the number in each sheet?

To obtain a list of unique values, you can copy column A (including
heading) from one sheet to a third sheet, and then copy the column A
values from the second sheet to just below where the first sheet's
values finish in the third sheet. Then highlight this column in the
third sheet and use Data | Filter | Advanced Filter and select Unique
Records Only and Copy to another location (specify where - I suggest
$C$1 in the third sheet). Click OK and you will have your unique list
in column C. You can then delete columns A and B.

It is probably better then to use VLOOKUP to obtain values from the
other two sheets. Assuming that they are both in the same workbook, and
that they are called Sheet1 and Sheet2, and that they have a header row
before the data, then put the same headers in row 1 of the third sheet.
In B2 you can enter this formula:

=IF(ISNA(VLOOKUP($A2,Sheet1!$A$2:$G$16804,COLUMN() ,0)),0,VLOOKUP($A2,Sheet1!$A$2:$G$16804,COLUMN(),0 ))+IF(ISNA(VLOOKUP($A2,Sheet2!$A$2:$G$16804,COLUMN (),0)),0,VLOOKUP($A2,Sheet2!$A$2:$G$16804,COLUMN() ,0))

All one formula - beware of line breaks.

Adjust the ranges to suit the data in Sheet1 and in Sheet2. The formula
can be copied across to cell G2.

I would suggest that you then copy the formula down each column in
turn, rather than down all 6 columns at the same time, as you may run
out of memory. Once you have copied it down a column, highlight all the
data in that column, click <copy followed by Edit | Paste Special |
Values (check) OK and <Esc to fix the values. When you have done this
for all 6 columns, you can delete Sheets 1 and 2 (assuming you have
them stored somewhere else).

Hope this helps.

Pete