Transpose Data.....I think

brandon16

Board Regular
Joined
Sep 29, 2014
Messages
133
Hi Guy's

Any idea how to I turn my data output from this....

201309201310201311201312201401
A130001826615300725025050
B015568.9904150001690047040
C0008750126082.4

<colgroup><col><col><col><col span="3"></colgroup><tbody>
</tbody>


to this very quickly please?

A20130913000
B2013090
C2013090
A20131018266
B20131015569
C2013100
A20131115300
B20131115000
C2013110
A2013127250
B20131216900
C2013128750
A20140125050
B20140147040
C201401126082

<colgroup><col><col><col></colgroup><tbody>
</tbody>

At the moment I am having to do it manually and I have a lot of data, I am hoping there is a quick win.

Thanks
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
I select the whole table and then when it come to selecting the drop down on the Pivot Wizard (Field one, field two etc) they are all blank. So I just end up with a table that looks exactly the same but in a pivot.
 
Upvote 0
if you got as far as the pivot table, then double click on the grand total, the cell in bottom right corner. what happens if you do?
 
Last edited:
Upvote 0
It is now displayed as

A 201309
A 201310
A 201311

B 201309
B 201310
B 201311

C 201309
C 201310
C 201311
 
Upvote 0
brandon16,

Here is a macro solution for you to consider that uses two arrays in memory.

With your raw data in the active worksheet range A1:F4, the results will be written beginning in the third column to the right of the last used column of your raw data.


Code:
Sub ReorganizeData()
' hiker95, 02/19/2018, ME1044107
Application.ScreenUpdating = False
Dim a As Variant, r As Long, c As Long, lr As Long, lc As Long, n As Long
Dim o As Variant, j As Long
With ActiveSheet
  lr = .Cells(Rows.Count, 1).End(xlUp).Row
  lc = .Cells(1, Columns.Count).End(xlToLeft).Column
  a = .Range(.Cells(1, 1), .Cells(lr, lc))
  n = (lr - 1) * (lc - 1)
  ReDim o(1 To n, 1 To 3)
  For c = 2 To lc
    For r = 2 To lr
      j = j + 1: o(j, 1) = a(r, 1): o(j, 2) = a(1, c): o(j, 3) = a(r, c)
    Next r
  Next c
  With .Cells(1, lc + 3).Resize(UBound(o, 1), UBound(o, 2))
    .Value = o
    .NumberFormat = "0"
  End With
  .UsedRange.Columns.AutoFit
End With
Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0
You can do this using formulas if you wish. Assuming your data example is in cells A1:F4, put these formulas in three adjacent cells (for your layout, I am using Columns H, I and J) and then copy them down...

H1: =INDEX(A$2:A$4,MOD(ROWS($1:1)-1,3)+1)

I1: =INDEX(B$1:F$1,1,INT((ROWS($1:1)-1)/3)+1)

J1: =INDEX($B$2:$F$4,MOD(ROWS($1:1)-1,3)+1,INT((ROWS($1:1)-1)/3)+1)
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,378
Members
448,955
Latest member
BatCoder

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