Excel multiple columns to rows

albatros8

New Member
Joined
Jun 20, 2024
Messages
2
Office Version
  1. 2013
Platform
  1. Windows
Dear,

I would kindly ask for help.
I'm using Excel 2013.


I have 16 columns and big numbers of rows (e.g. 300+)

I would like that each row, would be placed next to the ending (16th) column.

Example (only for 3 rows):
1,110​
1,090​
1,090​
1,089​
1,116​
1,107​
1,095​
1,090​
1,092​
1,090​
1,127​
1,097​
1,086​
1,103​
1,092​
1,109​
1,118​
1,097​
1,083​
1,084​
1,090​
1,119​
1,100​
1,084​
1,090​
1,087​
1,109​
1,087​
1,084​
1,086​
1,090​
1,090​
1,129​
1,092​
1,078​
1,078​
1,077​
1,116​
1,089​
1,086​
1,086​
1,089​
1,089​
1,106​
1,081​
1,081​
1,095​
1,090​

And I would like the result in one row only, e.g.:
1,110​
1,090​
1,090​
1,089​
1,116​
1,107​
1,095​
1,090​
1,092​
1,090​
1,127​
1,097​
1,086​
1,103​
1,092​
1,109​
1,118​
1,097​
1,083​
1,084​
1,090​
1,119​
1,100​
1,084​
1,090​
1,087​
1,109​
1,087​
1,084​
1,086​
1,090​
1,090​
1,129​
1,092​
1,078​
1,078​
1,077​
1,116​
1,089​
1,086​
1,086​
1,089​
1,089​
1,106​
1,081​
1,081​
1,095​
1,090​

Any help??
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Assuming data starts from A1:Px.
Code:
Sub test()
    Dim x As String, y As String, myArray
    With [a1].CurrentRegion
        x = Range("a1").Resize(, .Count).Address
        y = .Columns.Count
        myArray = Application.Index(.Value, Evaluate("index(roundup(column(" & x & ")/" & y & ",0),,)"), _
                Evaluate("if(mod(column(" & x & ")," & y & ")=0," & y & ",mod(column(" & x & ")," & y & "))"))
    End With
    Sheets.Add.[a1].Resize(, UBound(myArray)).Value = myArray
End Sub
 
Upvote 0
Or:

VBA Code:
Sub jec()
 Dim ar, j As Long, jj As Long, x As Long
 ar = Cells(1).CurrentRegion
 ReDim ary(UBound(ar) * UBound(ar, 2))
 
 For j = 1 To UBound(ar, 2)
   For jj = 1 To UBound(ar)
     ary(x) = ar(jj, j)
     x = x + 1
   Next
 Next
 
 Sheets.Add.Cells(1).Resize(, x) = ary
End Sub
 
Upvote 0
Assuming data starts from A1:Px.
Code:
Sub test()
    Dim x As String, y As String, myArray
    With [a1].CurrentRegion
        x = Range("a1").Resize(, .Count).Address
        y = .Columns.Count
        myArray = Application.Index(.Value, Evaluate("index(roundup(column(" & x & ")/" & y & ",0),,)"), _
                Evaluate("if(mod(column(" & x & ")," & y & ")=0," & y & ",mod(column(" & x & ")," & y & "))"))
    End With
    Sheets.Add.[a1].Resize(, UBound(myArray)).Value = myArray
End Sub

I'm still testing, but I think this will work.
(I had/have to learn how to use Macros though. I'm not an expert ;) )
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Formula OR VBA: Excel multiple columns to rows
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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