# Consolidate multiple data rows with three common elements and add specific values from each row

I need to consolidate 400.000 rows of order level data, by order number, while adding the ship quantity for each row with the same order number.
I need to consolidate multiple data rows with three common elements (Order number, Recipient, Ship Date) and add specific values from each row (Shipped quantity) and retain the common elements plus the sum of the Shipped quantity.

There are actually 60867 unique order numbers. So I expect to be able to consolidate down to that many unique rows with the summed Ship quantity and retaining the values mentioned in the Title.

```Order Number  Recipient                             Shipped Date    Shipped Qty
1540690       HBUK-02096-00850-ASHBOURNE - 00850    2/8/2012        10
1540690       HBUK-02096-00850-ASHBOURNE - 00850    2/8/2012        10
1540690       HBUK-02096-00850-ASHBOURNE - 00850    2/8/2012        10
1540690       HBUK-02096-00850-ASHBOURNE - 00850    2/8/2012        40
1540691       HBUK-02096-00858-CASTLEFORD - 00858   2/8/2012        10
1540691       HBUK-02096-00858-CASTLEFORD - 00858   2/8/2012        10
1540691       HBUK-02096-00858-CASTLEFORD - 00858   2/8/2012        30
```
• Can you use a pivot table? – Raystafarian Jul 22 '13 at 19:01

This should work

``````Sub Chris()
Dim lrow As Long

With ActiveSheet

lrow = .Cells(65536, 1).End(xlUp).Row

Do

If .Cells(lrow - 1, 1) = .Cells(lrow, 1) Then
.Cells(lrow - 1, 4) = .Cells(lrow - 1, 4) + .Cells(lrow, 4)
.Rows(lrow).Delete
End If

lrow = lrow - 1

Loop Until lrow < 2

End With

End Sub
``````