Forum Discussion
LazyShadow
Apr 01, 2022Copper Contributor
Help with complex string sorting in Excel
Hope someone can help me. So I have some data entries that come in at : 'Port 1 Magnitude Index:0' 'Port 1 Magnitude Index:1' 'Port 1 Magnitude Index:2' 'Port 1 Phase Index:0' 'Port 1 Phase Ind...
OliverScheurich
Apr 01, 2022Gold Contributor
Are there always 12 lines of data with the original data listed as in your example? This would mean that the data that contains "Index 0" always is in rows 1, 4, 7 and 10 (and so on with "Index 1" and "Index 2"). If so you can try the attached file. Click the button in cell F2 to start the macro.
Sub index()
Dim i As Integer
Dim z As Integer
Dim w As Integer
Dim v As Integer
For i = 1 To 3
For z = 1 To 4
Cells(z + w, 4).Value = Cells(i + v, 1).Value
v = v + 3
Next z
v = 0
w = w + 4
Next i
End Sub