Rearranging Data

H

haas786

Hi all,

I have given up trying this on my own and was hoping someone can help
with this - here's what I have going on:

I get an output of two columns from another software and paste it into
Excel. In Column A, there are numbers ranging from 1 to 1,000, often
repeating 2-5 times; in column B, I have random numbers. What I need
done is to in a way transpose the numbers for each of the repeating
ones in column A into a row. An example might be best:

Column A, Column B
1, 100
1, 234
1, 390
2, 900
2, 435
3, 67
3, 870
3, 670
3, 665
3, 890

With the list above, i want to achieve th follwing results:

1, 100, 234, 390
2, 900, 435
3, 67, 870, 670, 665, 890
and so on...

If you have any questions or need me to clarify further,please let me
know; I thank you in advance for your help.

Thanks!
 
D

Don Guillett

try this

Sub lineuplikenums()
mc = 1
For i = Cells(Rows.Count, mc).End(xlUp).Row To 2 Step -1
If Cells(i, mc) = Cells(i - 1, mc) Then
'MsgBox Cells(i - 1, mc + 1) & ", " & Cells(i, mc + 1)
Cells(i - 1, mc + 1).Value = _
Cells(i - 1, mc + 1) & ", " & Cells(i, mc + 1)
Rows(i).Delete
End If
Next
End Sub
 
H

haas786

Don,

Thank you so much for the code - it did the trick! I appreciate the
help!

Best regards,
-Haas
 
D

Don Guillett

Glad to help

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
Don,

Thank you so much for the code - it did the trick! I appreciate the
help!

Best regards,
-Haas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top