PDA

View Full Version : Looking to condense data with quantity totals



CellarDude
07-01-2020, 05:42 PM
Trying to condense like data with quantities and total them. So far I've been able to sort their like data but not able to condense and sum their totals. This is the actual data the sorts it, this works great but does not condense the data. "M" column is the width, "N" column is the by symbol (x), "O" column is the length, and "P" column is the quantity. What I'm looking to do is, if matching data in (M) and (O) combine them and sum their quantities into one total.


'This code will sort the data first by "width" then by "length"
Private Sub SortData_Click()


Sheets("Order200").Range("M3:P" & Sheets("Order200").Range("M3").End(xlDown).row).Sort _
key1:=Sheets("Order200").Range("M:M"), order1:=xlAscending, _
key2:=Sheets("Order200").Range("O:O"), order2:=xlAscending, _
Header:=xlNo


End Sub

Paul_Hossler
07-02-2020, 07:54 AM
I'd use a pivot table

CellarDude
07-02-2020, 10:00 AM
I'd use a pivot table

CellarDude
07-02-2020, 10:01 AM
Thank You, I'll have to look into using a pivot table.

Paul_Hossler
07-02-2020, 11:23 AM
Thank You, I'll have to look into using a pivot table.


If you attach a small representative sample workbook, I'm sure you'll be able to get lots of suggestions

mana
07-03-2020, 04:04 AM
Sub test()
Dim r As Range

Set r = Worksheets.Add.Cells(1)
Sheets("Order200").Columns("M:P").Copy r
Set r = r.CurrentRegion
Set r = Intersect(r, r.Offset(2)).Resize(, 5)

r.Columns(5).FormulaR1C1 = "=sumifs(c4:c4,c1:c1,rc1,c3:c3,rc3)"
r.Value = r.Value
r.RemoveDuplicates Array(1, 2, 3)
r.Columns(4).Delete xlToLeft

End Sub