Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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