Forum Discussion

LazyShadow's avatar
LazyShadow
Copper Contributor
Apr 01, 2022

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 Index:1'

'Port 1 Phase Index 2',

'Port 2 Magnitude Index:0'

'Port 2 Magnitude Index:1'

'Port 2 Magnitude Index:2'

'Port 2 Phase Index:0'

'Port 2 Phase Index:1'

'Port 2 Phase Index 2'

 

Is there a way to sort the data so I can get it formatted as:

'Port 1 Magnitude Index:0'

'Port 1 Phase Index:0'

'Port 2 Magnitude Index:0'

'Port 2 Phase Index:0'

'Port 1 Magnitude Index:1'

'Port 1 Phase Index:1'

'Port 2 Magnitude Index:1'

'Port 2 Phase Index:1'

'Port 1 Magnitude Index:2'

'Port 1 Phase Index:2'

'Port 2 Magnitude Index:2'

'Port 2 Phase Index:2'

 

In the case that I am given, the data loops through Port 1 Magnitude (at all index) then Port 1 Phase, then Port 2 Magnitude, and then Port 2 Phase. But I'm trying to sort the data by viewing all of 'Index:0' first and then 'Index:1' etc.

 

Can anyone help?

3 Replies