Link to home
Start Free TrialLog in
Avatar of Unreal1998
Unreal1998

asked on

Excel: Group duplicate records into one row with all relevant comments combined.

I have a report in Excel that has repeating values in column B. I would like to combine all the values in the last column. See attached file. I hope I can find a formula for the "Comments" column that I can drag down for over 1K records.
Test-File.xls
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

Unreal,
Basis of your example, You can use the following code and it will do what you are looking for...
Saurabh...

Sub delete()
    Dim i As Long
    i = 2
    Do Until i > Cells(65536, "B").End(xlUp).Row
        If Cells(i, "b").Value = Cells(i + 1, "b").Value Then
            Cells(i, "l").Value = Cells(i, "l").Value & "." & Cells(i + 1, "l").Value
            Rows(i + 1).delete
        Else
            i = i + 1
        End If
    Loop
 
 
 
End Sub

Open in new window

Avatar of Unreal1998
Unreal1998

ASKER

Wow! That's amazing!

Can you please customize the macro to do the same joining that was performed on column L to columns M and N at the same time? in other words, I want column M and N  to have comments from the related cells below, joined into one cell, just like L. I want all 3 done at the same time.

You are the genius!

ASKER CERTIFIED SOLUTION
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great job