Help sorting data header cell, header cell etc

Martynrbell

New Member
Joined
Apr 11, 2016
Messages
38
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I need to get data in a table to then list using the clumn header then the cell, per row.
Header1Header 2Header 3Header 4
FUBarHelloWorld
EndOf DaysCheese

<tbody>
</tbody>

using the table above as an example to display the below

Header1 "FU"
Header2 "Bar"
Header3 "Hello"
Header4 "World"

Header1 "End"
Header2 "Of"
Header3 "Days"
Header4 "Cheese"

The column range will be about 10 columns and the rows will be about 68 however i would like to configure it to different table ranges.

Can anyone help me sort this out?
Cheers

Martyn
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Your data must be start on sheet1 in cell A1

Try this macro:

Code:
Sub Sorting_Data()
Dim sh1 As Worksheet, sh2 As Worksheet
Set sh1 = Sheets("Sheet1")
Set sh2 = Sheets("Sheet2")
sh2.Cells.ClearContents
uc = sh1.Cells(1, Columns.Count).End(xlToLeft).Column
For i = 2 To sh1.Range("A" & Rows.Count).End(xlUp).Row
    sh2.Range("A" & Rows.Count).End(xlUp)(2).Resize(uc).Value = Application.Transpose(sh1.Range("A1").Resize(1, uc).Value)
    sh2.Range("B" & Rows.Count).End(xlUp)(2).Resize(uc).Value = Application.Transpose(sh1.Range("A" & i).Resize(1, uc).Value)
Next
End Sub
 
Upvote 0
try PowerQuery (Get&Transform)

Header1Header 2Header 3Header 4AttributeValue
FUBarHelloWorldHeader1FU
EndOfDaysCheeseHeader 2Bar
Header 3Hello
Header 4World
Header1End
Header 2Of
Header 3Days
Header 4Cheese

Code:
[SIZE=1]// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Unpivot = Table.UnpivotOtherColumns(Source, {}, "Attribute", "Value")
in
    Unpivot[/SIZE]
 
Upvote 0

Forum statistics

Threads
1,214,667
Messages
6,120,822
Members
448,990
Latest member
rohitsomani

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