Data Segregation

shansakhi

Active Member
Joined
Apr 5, 2008
Messages
292
Office Version
  1. 365
Platform
  1. Windows
Hello Everybody,
Request your assistance to segregate the data available in one column to multiple column.
There are multiple scenarios which are mentioned in the data.

IS there
ASR_BSP working.xlsx
ABCDEFGHIJKLM
1INPUTOUTPUT
2RoutingBus Name_1Sector_1Pax_1Bus Name_2Sector_2Pax_2Bus Name_3Sector_3Pax_3Bus Name_4Sector_4Pax_4
3AAA FF BBBFFAAA-BBB1
4AAA FF X BBBFFAAA-BBB1
5AAA FF O BBBFFAAA-BBB1
6AAA FF BBB ARNK ARNKFFAAA-BBB1
7AAA FF BBB BBB FF CCCFF AAA-BBB1FFBBB-CCC1
8AAA O BBB BBB FF O CCCFFBBB-CCC1
9AAA X BBB BBB FF X CCCFFBBB-CCC1
10AAA O BBB BBB FF X CCCFFBBB-CCC1
11AAA X BBB BBB FF O CCCFFBBB-CCC1
12AAA FF BBB BBB FF X CCCFF AAA-BBB1FFBBB-CCC1
13AAA FF BBB BBB FF O CCCFF AAA-BBB1FFBBB-CCC1
14AAA FF X BBB BBB FF X CCCFF AAA-BBB1FFBBB-CCC1
15AAA FF O BBB BBB FF X CCCFF AAA-BBB1FFBBB-CCC1
16AAA FF X BBB BBB FF O CCCFF AAA-BBB1FFBBB-CCC1
17AAA FF O BBB BBB FF O CCCFF AAA-BBB1FFBBB-CCC1
18AAA FF BBB BBB CCC CCC FF DDDFF AAA-BBB1FFCCC-DDD1
19AAA FF BBB ARNK ARNK CCC FF DDDFF AAA-BBB1FFCCC-DDD1
20AAA FF BBB BBB FF CCC CCC FF DDDFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1
21AAA FF BBB BBB O CCC CCC FF O DDDFF AAA-BBB1FFCCC-DDD1
22AAA FF BBB BBB X CCC CCC FF O DDDFF AAA-BBB1FFCCC-DDD1
23AAA FF BBB BBB O CCC CCC FF X DDDFF AAA-BBB1FFCCC-DDD1
24AAA FF BBB BBB X CCC CCC FF X DDDFF AAA-BBB1FFCCC-DDD1
25AAA O BBB BBB FF O CCC CCC FF X DDDFFBBB-CCC1FFCCC-DDD1
26AAA O BBB BBB FF X CCC CCC FF X DDDFFBBB-CCC1FFCCC-DDD1
27AAA X BBB BBB FF X CCC CCC FF X DDDFFBBB-CCC1FFCCC-DDD1
28AAA X BBB BBB FF X CCC CCC FF O DDDFFBBB-CCC1FFCCC-DDD1
29AAA X BBB BBB FF O CCC CCC FF O DDDFFBBB-CCC1FFCCC-DDD1
30AAA O BBB BBB FF O CCC CCC FF O DDDFFBBB-CCC1FFCCC-DDD1
31AAA FF BBB BBB FF X CCC CCC FF X DDDFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1
32AAA FF BBB BBB FF O CCC CCC FF X DDDFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1
33AAA FF BBB BBB FF X CCC CCC FF O DDDFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1
34AAA FF BBB BBB FF O CCC CCC FF O DDDFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1
35AAA FF O BBB BBB FF X CCC CCC FF X DDDFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1
36AAA FF BBB BBB FF CCC CCC DDD DDD FF EEEFF AAA-BBB1FFBBB-CCC1FFDDD-EEE1
37AAA FF BBB BBB FF CCC ARNK ARNK DDD FF EEEFF AAA-BBB1FFBBB-CCC1FFDDD-EEE1
38AAA FF BBB ARNK ARNK CCC FF DDD DDD FF EEEFF AAA-BBB1FFCCC-DDD1FFDDD-EEE1
39AAA FF BBB BBB FF CCC CCC FF DDD DDD FF EEEFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1FFDDD-EEE1
40AAA FF BBB BBB FF X CCC CCC O DDD DDD FF O EEEFF AAA-BBB1FFBBB-CCC1FFDDD-EEE1
41AAA FF BBB BBB FF O CCC CCC O DDD DDD FF O EEEFF AAA-BBB1FFBBB-CCC1FFDDD-EEE1
42AAA FF BBB BBB FF X CCC CCC X DDD DDD FF X EEEFF AAA-BBB1FFBBB-CCC1FFDDD-EEE1
43AAA FF BBB BBB FF X CCC CCC FF X DDD DDD O EEEFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1
44AAA FF BBB BBB FF X CCC CCC FF O DDD DDD O EEEFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1
45AAA FF BBB BBB FF O CCC CCC FF X DDD DDD O EEEFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1
46AAA FF BBB BBB FF X CCC CCC FF X DDD DDD X EEEFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1
47AAA FF BBB BBB O CCC CCC FF O DDD DDD FF X EEEFF AAA-BBB1FFCCC-DDD1FFDDD-EEE1
48AAA FF BBB BBB X CCC CCC FF X DDD DDD FF X EEEFF AAA-BBB1FFCCC-DDD1FFDDD-EEE1
49AAA FF X BBB BBB FF X CCC CCC X DDD DDD FF X EEEFF AAA-BBB1FFBBB-CCC1FFDDD-EEE1
50AAA FF X BBB BBB O CCC CCC FF O DDD DDD FF X EEEFF AAA-BBB1FFCCC-DDD1FFDDD-EEE1
51AAA FF BBB BBB FF X CCC CCC FF O DDD DDD FF X EEEFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1FFDDD-EEE1
52AAA FF BBB BBB FF X CCC CCC FF X DDD DDD FF O EEEFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1FFDDD-EEE1
53AAA FF BBB BBB FF X CCC CCC FF O DDD DDD FF O EEEFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1FFDDD-EEE1
54AAA FF BBB BBB FF O CCC CCC FF O DDD DDD FF X EEEFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1FFDDD-EEE1
55AAA FF BBB BBB FF O CCC CCC FF O DDD DDD FF O EEEFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1FFDDD-EEE1
56AAA FF BBB BBB FF X CCC CCC FF X DDD DDD FF X EEEFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1FFDDD-EEE1
57AAA FF BBB BBB FF O CCC CCC FF X DDD DDD FF O EEEFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1FFDDD-EEE1
58AAA FF BBB BBB FF O CCC CCC FF X DDD DDD FF X EEEFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1FFDDD-EEE1
59AAA FF O BBB BBB FF O CCC CCC FF X DDD DDD FF X EEEFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1FFDDD-EEE1
60AAA FF O BBB BBB FF X CCC CCC FF O DDD DDD FF X EEEFF AAA-BBB1FFBBB-CCC1FFCCC-DDD1FFDDD-EEE1
Sheet1
a way that I can do this via loading data and putting some formulas as raw file is very heavy.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
If that's exactly how the data appears (with no skips in the pattern) you can write nested if statements to print the segments to each cell/column.
 
Last edited:
Upvote 0
The Bus no and Sectors will change. Multiple Bus Nos and Sectors are available in data.
 
Upvote 0
Hi, based on the mini-sheet, the strings "O", "X" and "ARNK" are not included in the output. What do these mean?
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Check below :

tEMPO.xlsx
ABCDEFGHIJKLM
1INPUTOUTPUT
2RoutingBus Name_1Sector_1Pax_1Bus Name_2Sector_2Pax_2Bus Name_3Sector_3Pax_3Bus Name_4Sector_4Pax_4
3AAA FF BBBFFAAA-BBB1         
4AAA FF X BBBFFAAA-BBB1         
5AAA FF O BBBFFAAA-BBB1         
6AAA FF BBB ARNK ARNKFFAAA-BBB1         
7AAA FF BBB BBB FF CCCFFAAA-BBB1FFBBB-CCC1      
8AAA O BBB BBB FF O CCC   FFBBB-CCC1      
9AAA X BBB BBB FF X CCC   FFBBB-CCC1      
10AAA O BBB BBB FF X CCC   FFBBB-CCC1      
11AAA X BBB BBB FF O CCC   FFBBB-CCC1      
12AAA FF BBB BBB FF X CCCFFAAA-BBB1FFBBB-CCC1      
13AAA FF BBB BBB FF O CCCFFAAA-BBB1FFBBB-CCC1      
14AAA FF X BBB BBB FF X CCCFFAAA-BBB1FFBBB-CCC1      
15AAA FF O BBB BBB FF X CCCFFAAA-BBB1FFBBB-CCC1      
16AAA FF X BBB BBB FF O CCCFFAAA-BBB1FFBBB-CCC1      
17AAA FF O BBB BBB FF O CCCFFAAA-BBB1FFBBB-CCC1      
18AAA FF BBB BBB CCC CCC FF DDDFFAAA-BBB1   FFCCC-DDD1   
19AAA FF BBB ARNK ARNK CCC FF DDDFFAAA-BBB1   FFCCC-DDD1   
20AAA FF BBB BBB FF CCC CCC FF DDDFFAAA-BBB1FFBBB-CCC1FFCCC-DDD1   
21AAA FF BBB BBB O CCC CCC FF O DDDFFAAA-BBB1   FFCCC-DDD1   
22AAA FF BBB BBB X CCC CCC FF O DDDFFAAA-BBB1   FFCCC-DDD1   
23AAA FF BBB BBB O CCC CCC FF X DDDFFAAA-BBB1   FFCCC-DDD1   
24AAA FF BBB BBB X CCC CCC FF X DDDFFAAA-BBB1   FFCCC-DDD1   
25AAA O BBB BBB FF O CCC CCC FF X DDD   FFBBB-CCC1FFCCC-DDD1   
26AAA O BBB BBB FF X CCC CCC FF X DDD   FFBBB-CCC1FFCCC-DDD1   
27AAA X BBB BBB FF X CCC CCC FF X DDD   FFBBB-CCC1FFCCC-DDD1   
28AAA X BBB BBB FF X CCC CCC FF O DDD   FFBBB-CCC1FFCCC-DDD1   
29AAA X BBB BBB FF O CCC CCC FF O DDD   FFBBB-CCC1FFCCC-DDD1   
30AAA O BBB BBB FF O CCC CCC FF O DDD   FFBBB-CCC1FFCCC-DDD1   
31AAA FF BBB BBB FF X CCC CCC FF X DDDFFAAA-BBB1FFBBB-CCC1FFCCC-DDD1   
32AAA FF BBB BBB FF O CCC CCC FF X DDDFFAAA-BBB1FFBBB-CCC1FFCCC-DDD1   
33AAA FF BBB BBB FF X CCC CCC FF O DDDFFAAA-BBB1FFBBB-CCC1FFCCC-DDD1   
34AAA FF BBB BBB FF O CCC CCC FF O DDDFFAAA-BBB1FFBBB-CCC1FFCCC-DDD1   
35AAA FF O BBB BBB FF X CCC CCC FF X DDDFFAAA-BBB1FFBBB-CCC1FFCCC-DDD1   
36AAA FF BBB BBB FF CCC CCC DDD DDD FF EEEFFAAA-BBB1FFBBB-CCC1   FFDDD-EEE1
37AAA FF BBB BBB FF CCC ARNK ARNK DDD FF EEEFFAAA-BBB1FFBBB-CCC1   FFDDD-EEE1
38AAA FF BBB ARNK ARNK CCC FF DDD DDD FF EEEFFAAA-BBB1   FFCCC-DDD1FFDDD-EEE1
39AAA FF BBB BBB FF CCC CCC FF DDD DDD FF EEEFFAAA-BBB1FFBBB-CCC1FFCCC-DDD1FFDDD-EEE1
40AAA FF BBB BBB FF X CCC CCC O DDD DDD FF O EEEFFAAA-BBB1FFBBB-CCC1   FFDDD-EEE1
41AAA FF BBB BBB FF O CCC CCC O DDD DDD FF O EEEFFAAA-BBB1FFBBB-CCC1   FFDDD-EEE1
42AAA FF BBB BBB FF X CCC CCC X DDD DDD FF X EEEFFAAA-BBB1FFBBB-CCC1   FFDDD-EEE1
Sheet1
Cell Formulas
RangeFormula
B3:B42B3=IFERROR(IF(IFERROR(FIND("A FF B",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A3,"O ",""),"X ",""),"ARNK ","")),""),"FF",""),"")
C3:C42C3=IF(B3="FF","AAA-BBB","")
D3:D42,G3:G42,J3:J42,M3:M42D3=IF(B3="FF",1,"")
E3:E42E3=IFERROR(IF(IFERROR(FIND("B FF C",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A3,"O ",""),"X ",""),"ARNK ","")),""),"FF",""),"")
F3:F42F3=IF(E3="FF","BBB-CCC","")
H3:H42H3=IFERROR(IF(IFERROR(FIND("C FF D",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A3,"O ",""),"X ",""),"ARNK ","")),""),"FF",""),"")
I3:I42I3=IF(H3="FF","CCC-DDD","")
K3:K42K3=IFERROR(IF(IFERROR(FIND("D FF E",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A3,"O ",""),"X ",""),"ARNK ","")),""),"FF",""),"")
L3:L42L3=IF(K3="FF","DDD-EEE","")
 
Upvote 0
Thank you Sanjeev.
Here Sectors are dynamic it can be anything instead of AAA-BBB it can be LHR-MAN.
But your formula had given a hint where instead of hardcoded Sector, I can use Left / Right or MID formula to achieve desired result.
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Updated the Account details.. Thank you for suggetion.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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