Merge Rows, if

Blessy Clara

Board Regular
Joined
Mar 28, 2010
Messages
201
Hi All,

I have an excel sheet with two Columns, Organization Name and Type. I would like to merge all the types for a particular organization into one single row.

Example

[TABLE="width: 500"]
<tbody>[TR]
[TD][TABLE="width: 525"]
<tbody>[TR]
[TD="class: xl63, width: 525"]3Bridges Community Before School Care, After School Care and Vacation Care[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 198"]
<tbody>[TR]
[TD="class: xl65, width: 198"]After School Hours Care[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 525"]
<tbody>[TR]
[TD="class: xl65, width: 525"]3Bridges Community Before School Care, After School Care and Vacation Care[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 198"]
<tbody>[TR]
[TD="class: xl65, width: 198"]Before School Hours Care[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 525"]
<tbody>[TR]
[TD="class: xl65, width: 525"]3Bridges Community Before School Care, After School Care and Vacation Care[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 198"]
<tbody>[TR]
[TD="class: xl65, width: 198"]Vacation Care[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 525"]
<tbody>[TR]
[TD="class: xl65, width: 525"]3C Kidz Care - Maranatha[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 160"]
<tbody>[TR]
[TD="class: xl65, width: 160"]Occasional Care[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 525"]
<tbody>[TR]
[TD="class: xl65, width: 525"]3C Kidz Care - Maranatha[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 160"]
<tbody>[TR]
[TD="class: xl65, width: 160"]Long Day Care[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 525"]
<tbody>[TR]
[TD="class: xl65, width: 525"]3C Kidz Care - Maranatha[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 160"]
<tbody>[TR]
[TD="class: xl65, width: 160"]After School Hours Care[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 525"]
<tbody>[TR]
[TD="class: xl65, width: 525"]3C Kidz Care - Maranatha[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 160"]
<tbody>[TR]
[TD="class: xl65, width: 160"]Before School Hours Care[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 525"]
<tbody>[TR]
[TD="class: xl65, width: 525"]A1 Fun Greenfields[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 198"]
<tbody>[TR]
[TD="class: xl65, width: 198"]After School Hours Care[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 525"]
<tbody>[TR]
[TD="class: xl65, width: 525"]A1 Fun Greenfields[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 198"]
<tbody>[TR]
[TD="class: xl65, width: 198"]Vacation Care[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 525"]
<tbody>[TR]
[TD="class: xl65, width: 525"]After The Bell Aus- Eastwood PS[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]Vacation Care[/TD]
[/TR]
</tbody>[/TABLE]

Post Merge

[TABLE="width: 500"]
<tbody>[TR]
[TD]Organiztn[/TD]
[TD]Type[/TD]
[/TR]
[TR]
[TD]3Bridges Community Before School Care, After School Care and Vacation Care[/TD]
[TD]After School Hours Care, Before School Hours Care, Vacation Care[/TD]
[/TR]
[TR]
[TD]3C Kidz Care - Maranatha[/TD]
[TD]Occasional Care, Long day care, After School Hours Care, Before School Hours Care[/TD]
[/TR]
[TR]
[TD]A1 Fun Greenfields[/TD]
[TD]After School Hours Care, Vacation Care[/TD]
[/TR]
[TR]
[TD]After The Bell Aus- Eastwood PS[/TD]
[TD]Vacation Care[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Thanks in advance for any help
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hello,

Never merge cells within Excel ... !!!

Excel is not a common word processor ...

You could use some concatenation ... to achieve your goal ...
 
Last edited:
Upvote 0
How about
Code:
Sub MergeData()

   Dim Cl As Range
   Dim Dic As Object
   Dim Ky As Variant
   
   Set Dic = CreateObject("scripting.dictionary")
   With Dic
      For Each Cl In Range("A2", Range("A" & Rows.Count).End(xlUp))
         If Not .exists(Cl.Value) Then
            .Add Cl.Value, Cl.Offset(, 1).Value
         Else
            .Item(Cl.Value) = .Item(Cl.Value) & ", " & Cl.Offset(, 1).Value
         End If
      Next Cl
      For Each Ky In .keys
         With Range("D" & Rows.Count).End(xlUp)
            .Offset(1).Value = Ky
            .Offset(1, 1).Value = Dic(Ky)
         End With
      Next Ky
   End With
   
End Sub
I've assumed that your data is in cols A:B starting in row 2.
This will give the output in col D:E
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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