Home » excel » Excel – Split apart a list

Excel – Split apart a list

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have a list of about 300 items, that I need spaced out every 8 cells as opposed to being one after the other. I’m sure there is an easy way to do this, however my brain is failing me. I have a feeling my terminology is hurting hence why I can’t find an answer.

enter image description here

How to&Answers:
=IF(MOD(ROW()+7;8)=0;INDEX(A:A;INT(ROW()/8)+1);"")

Given that data begins at A1 and formula is used from row 1 (coulmn is not important).

Answer:

Try below code

Sub Main()


    Dim lastRow As Long
    lastRow = Range("A" & Rows.Count).End(xlUp).Row

    For i = 1 To lastRow
        If i = 1 Then
            Cells(i, 5).Value = Cells(i, 1)
        Else
            Cells((i - 1) * 9, 5).Value = Cells(i, 1)
        End If
    Next

End Sub

Output

enter image description here

Answer:

Can you please post a screen shot or add some additional detail?

Two things come to my mind for possible solutions:

1) Use Text to columns (if that is where you’re going with this) or

2) Use a formula like =LEFT(A1, 10) in the 8th column and fill down (10 can be changed to whatever the first part of the string is that needs to be separated).

Provide some additional info and I’ll take another look!