A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Transpose Multiple Rows to one



 
 
Thread Tools Display Modes
  #1  
Old April 14th, 2010, 03:57 PM posted to microsoft.public.excel.misc
Demosthenes
external usenet poster
 
Posts: 35
Default Transpose Multiple Rows to one

Hello,

I'm trying to change the format of my data. Ex:

apple 2
ab cd
orange 5
ef gh
banana 4
cd ef

And I want to get it to the format:

apple 2 ab cd
orange 5 ef gh
banana 4 cd ef

Is there an easy way to do that? I can't figure it out with transpose or the
offset function.

Thanks!
  #2  
Old April 14th, 2010, 04:12 PM posted to microsoft.public.excel.misc
Don Guillett[_2_]
external usenet poster
 
Posts: 607
Default Transpose Multiple Rows to one

try this

Sub rearrangeem()
Dim i As Long
lr = Cells(Rows.Count, 1).End(xlUp).Row
If lr / 2 Int(lr / 2) Then lr = lr - 1
'MsgBox lr
For i = lr To 2 Step -2
Cells(i - 1, 3) = Cells(i, 1)
Cells(i - 1, 4) = Cells(i, 2)
Rows(i).Delete
Next i
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Demosthenes" wrote in message
...
Hello,

I'm trying to change the format of my data. Ex:

apple 2
ab cd
orange 5
ef gh
banana 4
cd ef

And I want to get it to the format:

apple 2 ab cd
orange 5 ef gh
banana 4 cd ef

Is there an easy way to do that? I can't figure it out with transpose or
the
offset function.

Thanks!


  #3  
Old April 14th, 2010, 05:15 PM posted to microsoft.public.excel.misc
Demosthenes
external usenet poster
 
Posts: 35
Default Transpose Multiple Rows to one

Thanks, but I'd like to do it without using a macro. Do you know of another
way to do it?

"Don Guillett" wrote:

try this

Sub rearrangeem()
Dim i As Long
lr = Cells(Rows.Count, 1).End(xlUp).Row
If lr / 2 Int(lr / 2) Then lr = lr - 1
'MsgBox lr
For i = lr To 2 Step -2
Cells(i - 1, 3) = Cells(i, 1)
Cells(i - 1, 4) = Cells(i, 2)
Rows(i).Delete
Next i
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Demosthenes" wrote in message
...
Hello,

I'm trying to change the format of my data. Ex:

apple 2
ab cd
orange 5
ef gh
banana 4
cd ef

And I want to get it to the format:

apple 2 ab cd
orange 5 ef gh
banana 4 cd ef

Is there an easy way to do that? I can't figure it out with transpose or
the
offset function.

Thanks!


.

  #5  
Old April 14th, 2010, 06:32 PM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 19,791
Default Transpose Multiple Rows to one

With your test data in A1:B6, I used this:

In C1: =A2
In D1: =B2

Then I selected C12 (4 cells!)
And dragged it down as far as I needed.

Then I selected columns C and converted to values.
(edit|copy followed by edit|paste special values)

Then I selected just column C
Edit|Goto (or ctrl-g)
special
Blanks
Edit|Delete|entirerow



Demosthenes wrote:

Hello,

I'm trying to change the format of my data. Ex:

apple 2
ab cd
orange 5
ef gh
banana 4
cd ef

And I want to get it to the format:

apple 2 ab cd
orange 5 ef gh
banana 4 cd ef

Is there an easy way to do that? I can't figure it out with transpose or the
offset function.

Thanks!


--

Dave Peterson
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:31 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.