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

3Bridges Community Before School Care, After School Care and Vacation Care

<tbody>
</tbody>
After School Hours Care

<tbody>
</tbody>
3Bridges Community Before School Care, After School Care and Vacation Care

<tbody>
</tbody>
Before School Hours Care

<tbody>
</tbody>
3Bridges Community Before School Care, After School Care and Vacation Care

<tbody>
</tbody>
Vacation Care

<tbody>
</tbody>
3C Kidz Care - Maranatha

<tbody>
</tbody>
Occasional Care

<tbody>
</tbody>
3C Kidz Care - Maranatha

<tbody>
</tbody>
Long Day Care

<tbody>
</tbody>
3C Kidz Care - Maranatha

<tbody>
</tbody>
After School Hours Care

<tbody>
</tbody>
3C Kidz Care - Maranatha

<tbody>
</tbody>
Before School Hours Care

<tbody>
</tbody>
A1 Fun Greenfields

<tbody>
</tbody>
After School Hours Care

<tbody>
</tbody>
A1 Fun Greenfields

<tbody>
</tbody>
Vacation Care

<tbody>
</tbody>
After The Bell Aus- Eastwood PS

<tbody>
</tbody>
Vacation Care

<tbody>
</tbody>

Post Merge

OrganiztnType
3Bridges Community Before School Care, After School Care and Vacation CareAfter School Hours Care, Before School Hours Care, Vacation Care
3C Kidz Care - MaranathaOccasional Care, Long day care, After School Hours Care, Before School Hours Care
A1 Fun GreenfieldsAfter School Hours Care, Vacation Care
After The Bell Aus- Eastwood PSVacation Care

<tbody>
</tbody>

Thanks in advance for any help
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
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,215,072
Messages
6,122,968
Members
449,095
Latest member
Mr Hughes

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