0

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
  • 1
    Can you use a pivot table? – Raystafarian Jul 22 '13 at 19:01
0

This should work

Sub Chris()
Dim lrow As Long

With ActiveSheet

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

.Cells(1).CurrentRegion.Sort key1:=.Cells(1), Header:=xlYes

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

adapted from source

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.