Need help merging cels based on another cel

gyagos

New Member
Joined
Mar 27, 2018
Messages
27
Office Version
  1. 365
Platform
  1. Windows
All,
I have been trying to figure out how to do this, but i have been unsuccessful so far. I have a spreadsheet (below is just a snippet) that contains the following information:

[TABLE="width: 500"]
<tbody>[TR]
[TD]GROUP[/TD]
[TD]User[/TD]
[/TR]
[TR]
[TD]Telecom-Corp
[/TD]
[TD]User 1
[/TD]
[/TR]
[TR]
[TD]Telecom-Corp[/TD]
[TD]User 2
[/TD]
[/TR]
[TR]
[TD]Telecom-Corp[/TD]
[TD]User 3[/TD]
[/TR]
[TR]
[TD]Telecom-Corp[/TD]
[TD]User 4[/TD]
[/TR]
[TR]
[TD]Telecom-Corp[/TD]
[TD]User 5[/TD]
[/TR]
[TR]
[TD]Telecom-Corp[/TD]
[TD]User 6
[/TD]
[/TR]
[TR]
[TD]Data Center Platform - Windows Software[/TD]
[TD]User 1[/TD]
[/TR]
[TR]
[TD]CMS-Charlotte[/TD]
[TD]User 1[/TD]
[/TR]
[TR]
[TD]CMS-Charlotte[/TD]
[TD]User 2[/TD]
[/TR]
[TR]
[TD]CMS-Charlotte[/TD]
[TD]User 3[/TD]
[/TR]
[TR]
[TD]CMS-Charlotte[/TD]
[TD]User 4[/TD]
[/TR]
[TR]
[TD]Collaboration Engineering[/TD]
[TD]User 1[/TD]
[/TR]
[TR]
[TD]Collaboration Engineering[/TD]
[TD]User 2[/TD]
[/TR]
[TR]
[TD]Collaboration Engineering[/TD]
[TD]User 3[/TD]
[/TR]
[TR]
[TD]Collaboration Engineering[/TD]
[TD]User 4[/TD]
[/TR]
[TR]
[TD]Database Software[/TD]
[TD]User 1[/TD]
[/TR]
</tbody>[/TABLE]


What i would like to do is if the GROUP has multiple users, combine all users within the group so that the new list would be like the following:

[TABLE="width: 471"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][TABLE="width: 500"]
<tbody>[TR]
[TD]Group[/TD]
[TD]Users[/TD]
[/TR]
[TR]
[TD]Telecom-Corp[/TD]
[TD]User 1, User 2, User 3, User 4, User 5, User 6[/TD]
[/TR]
[TR]
[TD]CMS-Charlotte[/TD]
[TD]User 1, User 2, User 3, User 4[/TD]
[/TR]
[TR]
[TD]Collaboration Engineering[/TD]
[TD]User 1, User 2, User 3, User 4[/TD]
[/TR]
[TR]
[TD]Data Center Platform - Windows Software[/TD]
[TD]User 1[/TD]
[/TR]
[TR]
[TD]Database Software[/TD]
[TD]User 1[/TD]
[/TR]
</tbody>[/TABLE]

[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Any help would be greatly appreciated
Thank you in Advance[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
How about
Code:
Sub gyagos()
   Dim Cl As Range
   Dim Dic As Object
   Dim Ky As Variant
   
   Set Dic = CreateObject("scripting.dictionary")
   For Each Cl In Range("A2", Range("A" & Rows.Count).End(xlUp))
      If Not Dic.Exists(Cl.Value) Then Dic.Add Cl.Value, CreateObject("scripting.dictionary")
      Dic(Cl.Value)(Cl.Offset(, 1).Value) = Empty
   Next Cl
   For Each Ky In Dic.keys
      Range("E" & Rows.Count).End(xlUp).Offset(1).Resize(, 2).Value = Array(Ky, Join(Dic(Ky).keys, ", "))
   Next Ky
End Sub
 
Upvote 0
Works perfectly
Thank you very much for the quick response & solution
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,702
Messages
6,173,936
Members
452,539
Latest member
delvey

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top