ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Sum duplicates unique values and delete dupliques (https://www.excelbanter.com/excel-worksheet-functions/145582-sum-duplicates-unique-values-delete-dupliques.html)

Dave

Sum duplicates unique values and delete dupliques
 
Hi,

my problem is that I have a list with duplicate entries and values attached
to them like this:

col a col b
12 2
12 3
14 5

I'm searching for a macro that would turn my list into this:

col a col b
12 5
14 5

Or like this:

col a col b col c
12 2 3
14 5

So if you could please help me, I would be very grateful!

Please respond also to my email because I have had
problems entering the community and finding spicific threads.

-Dave

Bob Phillips

Sum duplicates unique values and delete dupliques
 
I prefer the latter

Public Sub ProcessData()
Dim i As Long
Dim iLastRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = iLastRow To 2 Step -1
If .Cells(i, "A").Value = .Cells(i - 1, "A").Value Then
.Cells(i, "B").Resize(, _
.Cells(i, .Columns.Count).End(xlToLeft).Column - 1).Copy
..Cells(i - 1, "C")
.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)

"Dave" wrote in message
...
Hi,

my problem is that I have a list with duplicate entries and values
attached
to them like this:

col a col b
12 2
12 3
14 5

I'm searching for a macro that would turn my list into this:

col a col b
12 5
14 5

Or like this:

col a col b col c
12 2 3
14 5

So if you could please help me, I would be very grateful!

Please respond also to my email because I have had
problems entering the community and finding spicific threads.

-Dave





All times are GMT +1. The time now is 11:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com