How to convert CSV data into columns?

cdmurray

New Member
Joined
Aug 31, 2021
Messages
8
I have a CSV file where some data has headers. The cycle on the line repeats, but as you see it does not have any header info. How do I get the columns to the right to look like the example below. Sorry if I am not explaining properly, but hopefully the graphic helps.

original

TimestampBlockStepMnemonicValueTol_LowTol_High
23:03.5​
50​
1​
MGBLHL14
23434​
322134​
2342​
23:03.5​
50​
1​
CM37208B
123412​
213412​
1234​
23:03.5​
50​
1​
CM30804B
23421​
123413​
2134124​
23:03.5​


Want to convert to:

TimestampBlockStepMnemonicValueTol_LowTol_High
23:03.5​
50​
1​
MGBLHL14
23434​
322134​
2342​
23:03.5​
50​
1​
CM37208B
123412​
213412​
1234​
23:03.5​
50​
1​
CM30804B
23421​
123413​
2134124​
 

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
Hi cdmurray,

Welcome to MrExcel!!

Put this formula into cell A3...

=OFFSET(A$2,0,ROW()*(ROW()-1)+ROW()-2)

...copy it across B3:G3 and then copy A3:G3 down as many rows required.

Regards,

Robert
 
Upvote 0
Hi cdmurray,

Welcome to MrExcel!!

Put this formula into cell A3...

=OFFSET(A$2,0,ROW()*(ROW()-1)+ROW()-2)

...copy it across B3:G3 and then copy A3:G3 down as many rows required.

Regards,

Robert
Hi, I tried to use the formula as suggested and it seems to be skipping over data in 2 columns. Any suggestions?
 
Upvote 0
Hi cdmurray,

Welcome to MrExcel!!

Put this formula into cell A3...

=OFFSET(A$2,0,ROW()*(ROW()-1)+ROW()-2)

...copy it across B3:G3 and then copy A3:G3 down as many rows required.

Regards,

Robert
That formula will work for rows 3 and 4 but not thereafter.

Try =OFFSET(A$2,0,(ROW()-2)*7) in A3 drag across and down
 
Upvote 0
Solution
or in power query:

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    lst1 = Record.ToList(Source{0}),
    numRowCount = Number.IntegerDivide(List.Count(lst1),7),
    lst2 = List.Transform({1..numRowCount}, each List.FirstN(List.Skip(lst1,(_ -1)*7),7)),
    tblResult = Table.FromRows(lst2,List.FirstN(Table.ColumnNames(Source),7))
in
    tblResult
 
Upvote 0

Forum statistics

Threads
1,215,353
Messages
6,124,458
Members
449,161
Latest member
NHOJ

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