Forum Discussion
gkilar
Dec 08, 2021Copper Contributor
Merge Rows with same name but different data
Good Afternoon,
I have a long spreadsheet that was exported from an aging software. Each customer has a different record for each form of contact. I need to merge all several thousand of these rows to one per customer while retaining all the contact methods.
I made a quick example of what I am dealing with.
3 Replies
Another option:
Sub CombineRows() Dim m As Long Dim r As Long Dim c As Long Application.ScreenUpdating = False m = Cells(Rows.Count, 1).End(xlUp).Row r = 2 Do Do While Cells(r + 1, 1).Value = Cells(r, 1).Value For c = 4 To 8 If Cells(r + 1, c).Value <> "" Then Cells(r + 1, c).Copy Destination:=Cells(r, c) End If Next c Cells(r + 1, 1).EntireRow.Delete Loop r = r + 1 Loop Until Cells(r, 1).Value = "" Application.CutCopyMode = False Application.ScreenUpdating = True End Sub
- OliverScheurichGold Contributor
In the attached file click on the blue button until all data is added to all rows of each single customer. Then select columns A to H and apply delete duplicates. This could be what you want to do.
- SergeiBaklanDiamond Contributor
Power Query could work. If you consider such option better to attach sample Excel file instead of screenshot.