Macro to copy, paste, move. Rows to Columns

mjws

New Member
Joined
Aug 1, 2021
Messages
1
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. MacOS
Hi everyone,

I have a list of data which is all in one column, essentially I am trying to create a macro or formula that will move all the text from the column into the correct row. Row 2 shows how the data should look. Essentially I am trying to convert all of the data currently in column A, to the format currently in row 2. Anyone have any good ideas?

Attached is the Excel sheet snip.
 

Attachments

  • B List-min.png
    B List-min.png
    162.9 KB · Views: 22

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
This is doable with a few lines using Power Query.
1. Make your column a Excel Table. In the example below, I renamed the Table tblBnaires and the column header (A1) "Bnaires".
1627890326341.png

2. Then from the menu, Data > From Table/Range. Go to the Advanced Editor
1627890885495.png

...and enter:
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="tblBnaires"]}[Content],
    TableFromRowsListSplit = Table.FromRows(List.Split(Source[Bnaires],8)),
    Final = Table.RenameColumns(TableFromRowsListSplit,{{"Column1", "Rank"}, {"Column2", "Name"}, {"Column3", "Net Worth"}, {"Column4", "Traj"}, {"Column5", "Age"}, {"Column6", "Country"}, {"Column7", "Source"}, {"Column8", "Industry"}})
in
    Final
The code splits the list every 8th row, then takes those rows and turns them back into a table. In Final, the column headers are renamed to what you want.
"Close and Load" to wherever you want the output - I put it to C3, as shown:
1627890536257.png
 
Upvote 0

Forum statistics

Threads
1,224,737
Messages
6,180,659
Members
452,992
Latest member
TokugawaIesuma

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