Moving the columns from horizontal to vertical

dankar

Board Regular
Joined
Mar 23, 2016
Messages
113
Office Version
  1. 365
Platform
  1. Windows
[TABLE="width: 500"]
<tbody>[TR]
[TD]ID
[/TD]
[TD]FIRST NAME
[/TD]
[TD]LAST NAME
[/TD]
[TD]DATE
[/TD]
[TD]PHONE#
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]ALLAN
[/TD]
[TD]SMITH
[/TD]
[TD]05/30/2019
[/TD]
[TD]4701325555
[/TD]
[/TR]
</tbody>[/TABLE]

To become like this:


[TABLE="width: 200"]
<tbody>[TR]
[TD]ID
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]FIRST NAME
[/TD]
[TD]ALLAN
[/TD]
[/TR]
[TR]
[TD]LAST NAME
[/TD]
[TD]SMITH
[/TD]
[/TR]
[TR]
[TD]DATE
[/TD]
[TD]05/30/2019
[/TD]
[/TR]
[TR]
[TD]PHONE#
[/TD]
[TD]4701325555
[/TD]
[/TR]
</tbody>[/TABLE]


Hi,

1. I have an excel file with over than 200 columns, I want to copy the heading to vertical position.

2. If possible also to copy the result also.

is there an easy way to do this. thanks
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
This is pretty easy to do. Let's work with your example (and let's say the data is in cella A1:E2).
1. Select the entire range (A1:E2)
2. Select Copy (CTRL + C)
3. Select cell A3
4. Right-click, and select Paste Special --> Transpose --> OK
5. Delete rows 1 and 2

That's it!
It will work for 200 columns just as easily as it does for 5
 
Last edited:
Upvote 0
An alternative option is to bring the data into Power Query and unpivot the columns.

Here is the Mcode

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {}, "Attribute", "Value")
in
    #"Unpivoted Columns"

[table="class:thin_grid"]
[tr][td]v[/td]
[td="bgcolor:#ECF0F0, align:center"]A[/td]
[td="bgcolor:#ECF0F0, align:center"]B[/td]
[/tr][tr][td="bgcolor:#ECF0F0, align:center"]1[/td]
[td="bgcolor:#FFFFFF, align:CENTER"]Attribute[/td]
[td="bgcolor:#FFFFFF, align:CENTER"]Value[/td]
[/tr]
[tr][td="bgcolor:#ECF0F0, align:center"]2[/td]
[td="bgcolor:#FFFFFF, align:CENTER"]ID[/td]
[td="bgcolor:#FFFFFF, align:CENTER"]1[/td]
[/tr]
[tr][td="bgcolor:#ECF0F0, align:center"]3[/td]
[td="bgcolor:#FFFFFF, align:CENTER"]FIRST NAME[/td]
[td="bgcolor:#FFFFFF, align:CENTER"]ALLAN[/td]
[/tr]
[tr][td="bgcolor:#ECF0F0, align:center"]4[/td]
[td="bgcolor:#FFFFFF, align:CENTER"]LAST NAME[/td]
[td="bgcolor:#FFFFFF, align:CENTER"]SMITH[/td]
[/tr]
[tr][td="bgcolor:#ECF0F0, align:center"]5[/td]
[td="bgcolor:#FFFFFF, align:CENTER"]DATE[/td]
[td="bgcolor:#FFFFFF, align:CENTER"]5/30/2019[/td]
[/tr]
[tr][td="bgcolor:#ECF0F0, align:center"]6[/td]
[td="bgcolor:#FFFFFF, align:CENTER"]PHONE#[/td]
[td="bgcolor:#FFFFFF, align:CENTER"]4701325555[/td]
[/tr]
[/table]
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,201
Members
453,022
Latest member
RobertV1609

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