# Thread: Looking to condense data with quantity totals

1. ## Looking to condense data with quantity totals

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, _

End Sub```

2. I'd use a pivot table

3. Originally Posted by Paul_Hossler
I'd use a pivot table

4. Thank You, I'll have to look into using a pivot table.

5. Originally Posted by CellarDude
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

6. ```Sub test()
Dim r As Range

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```

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•