Transpose data from one column to several ones

Veyron

New Member
Joined
Sep 6, 2015
Messages
20
Good night everyone,

I have a list of data all in one column that I need to separate in several columns.

Raw source:

Column A
Text 1
Text 2
Text 3
...
Tex 8
Text 1
Text 2
Text 3
...
Tex 8
Text 1
Text 2
Text 3
...
Tex 8

up to 7,000 lines.

I would like something like this:

Column Text 1Column Text 2Column Text 3Column Text 4Column Text 5Column Text 6Column Text 7Column Text 8
Text 1Text 2Text 3Text 4Text 5Text 6Text 7Text 8
Text 1Text 2Text 3Text 4Text 5Text 6Text 7Text 8

I know there should be many ways to approach this problem that I am trying some of them and in all of them I am missing something.
I have tried pivot tables and couldn't make it work. Tried Power Pivot but I don't have enough knowledge to use it, tried doing a frankenstein macro with similar questions in this forum but it did not work either.

Can someone please give me a hand?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
How about:

VBA Code:
Sub Transpose_Data()
  Dim a As Variant, i As Long, j As Long, k As Long
  a = Range("A1", Range("A" & Rows.Count).End(3)).Value2
  ReDim b(1 To UBound(a), 1 To 8)
  For i = 1 To UBound(a) Step 8
    j = j + 1
    For k = 1 To 8
      b(j, k) = a(i, 1)
    Next
  Next
  Range("B1").Resize(j, 8).Value = b
End Sub

___________________________________________________________
Or this:
VBA Code:
Sub transpose_data1()
  Dim i As Long
  For i = 1 To Range("A" & Rows.Count).End(3).Row Step 8
    Range("B" & Rows.Count).End(3)(2).Resize(1, 8).Value = Range("A" & i).Resize(8).Value
  Next
End Sub
 
Upvote 0
How about:
...

Thanks for your kind answer DanteAmor but I have not been able to make it work properly.
Both of them do the same: They correctly take each "Text 1" from the list and create 8 columns but populate all of them with "Text 1".

Example (only talking about text 1):

List
AAA
...
BBB
...
CCC

This is what I get with your codes:

AAA AAA AAA AAA AAA AAA AAA AAA
BBB BBB BBB BBB BBB BBB BBB BBB
CCC CCC CCC CCC CCC CCC CCC CCC

Let me know if you need me to post image or the example with XL2BB tool.
 
Upvote 0
Sorry about that, try this:

VBA Code:
Sub transpose_data1()
  Dim i As Long
  For i = 1 To Range("A" & Rows.Count).End(3).Row Step 8
    Range("B" & Rows.Count).End(3)(2).Resize(1, 8).Value = Application.Transpose(Range("A" & i).Resize(8).Value)
  Next
End Sub
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,830
Members
449,096
Latest member
Erald

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