0

I have a spreadsheet where values in column F are delimited by a soft break.

Currently

I would the values in cell (F2) to be separated into multiple rows, while the values left of column F repeat themselves like in the image below.

what i am trying to achieve

I found a post where the user is able to deliver my solution if there are only two columns.

user716255
  • 352
  • 1
  • 6
  • 18

2 Answers2

0

Modified the code on this post. It generated the solution I wanted. VBA: Split cell values into multiple rows and keep other data

Sub splitByColF()
    Dim r As Range, i As Long, ar
    Set r = Worksheets("Sheet1").Range("F999999").End(xlUp)
    Do While r.Row > 1
        ar = Split(r.Value, Chr(10))
        If UBound(ar) >= 0 Then r.Value = ar(0)
        For i = UBound(ar) To 1 Step -1
            r.EntireRow.Copy
            r.Offset(1).EntireRow.Insert
            r.Offset(1).Value = ar(i)
        Next
        Set r = r.Offset(-1)
    Loop
End Sub
user716255
  • 352
  • 1
  • 6
  • 18
0

I found a solution using Power Query in Excel. Click [ctlr] + [a] to select all and then [ctlr] + [t].

Go to the Data Ribbon and click on [From Table] enter image description here

In Power Query highlight the column you are interested in delimiting. Then click [Split Column] then select [By Delimiter]

enter image description here

Mirror the screenshot below. Click OK and [Close & Load] on the left hand corner.

enter image description here

The end result should look like this. enter image description here

user716255
  • 352
  • 1
  • 6
  • 18