Summarizing doubles
I have a rather lengthy list of products sold by the company I work for; one
column with the product name, one column with the number of articles sold. There are many instances where the same product appears on several rows. I am looking for a way to remove the doubles in the first column, but summarize the different values in the second column into one. How? |
Summarizing doubles
Sub TidyUp()
Dim LastRow As Long Dim pos As Long Dim i As Long With ActiveSheet LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = LastRow To 3 Step -1 pos = 0 On Error Resume Next pos = Application.Match(.Cells(i, "A").Value, ..Range("A1").Resize(i - 1), 0) On Error GoTo 0 If pos 0 Then .Cells(pos, "B").Value = .Cells(pos, "B").Value + .Cells(i, "B").Value .Rows(i).Delete End If Next i End With End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Sippan" wrote in message ... I have a rather lengthy list of products sold by the company I work for; one column with the product name, one column with the number of articles sold. There are many instances where the same product appears on several rows. I am looking for a way to remove the doubles in the first column, but summarize the different values in the second column into one. How? |
All times are GMT +1. The time now is 01:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com