# Merge duplicate rows into one!

#### MACEOCH

##### New Member
Hi guys,

I'm doing some medical research and I'm having difficulty arranging my excel data. I'm sure what I need done is very straightforward but I'm still only learning the basics of excel so I was wondering if someone wouldn't mind taking a quick look!

My Data is arranged in two columns as follows-

 A 1 A 2 A 3 B 4 B 5 C 6 D 7 E 8 E 9 E 10

<tbody>
</tbody>

and I need to rearrange it so it looks like the following:
 A 1 2 3 B 4 5 C 6 D 7 E 8 9 10

<tbody>
</tbody>

I'm sure this can't be too difficult! I played around at it for about an hour but to be honest I think I'm stumped!
Thanks a million.

Dr C

### Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Try this:-
Results Start "F1"
Code:
[COLOR="Navy"]Sub[/COLOR] MG25May07
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] Q [COLOR="Navy"]As[/COLOR] Variant, n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] Ray(), oMax [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
[COLOR="Navy"]If[/COLOR] Not .Exists(Dn.Value) [COLOR="Navy"]Then[/COLOR]
n = n + 1
ReDim Preserve Ray(1 To Rng.Count, 1 To n)
Ray(1, n) = Dn.Value
Ray(2, n) = Dn.Offset(, 1)
[COLOR="Navy"]Else[/COLOR]
Q = .Item(Dn.Value)
Q(0) = Q(0) + 1
Ray(Q(0), Q(1)) = Dn.Offset(, 1)
oMax = Application.Max(oMax, Q(0))
.Item(Dn.Value) = Q
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR]
Range("F1").Resize(n, oMax) = Application.Transpose(Ray)
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]With[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick

Fantastic! Thank you so much, you really helped me out!

Kind regards and best wishes
Dr C

You're Welcome

Replies
4
Views
386
Replies
19
Views
782
Replies
2
Views
243
Replies
1
Views
482
Replies
4
Views
200

1,203,205
Messages
6,054,140
Members
444,703
Latest member
pinkyar23

### 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.

### Which adblocker are you using?

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

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