RE-ARRANGE TEXT STRING ORDER DUE TO A WORD "TO"

AFZAL SOHAIL

Board Regular
Joined
May 31, 2023
Messages
115
Office Version
  1. 2021
  2. 2016
Platform
  1. Windows
Hello!,Dear Team, I need a formula who re-arrange the Text String in a Cell with reference to the word in this text string is "to"
My Data is as under:-
8078-AIT (2/0/1) to C-12 Neelam Block
Allama Iqbal town 8078 (2/0/1) to C-12 Neelam Block
8061 ARZ (11/0/2) to Dream Garden MSAG
8061 ARZ (2/0/6) to MSAG-56 Jalal Estate Edenabad
8061-ARZ to 8060-BTN
AliRazabad OLT to C04 Hajvery Textile
8061-ARZ (11/0/7) to C-3/4 Bhobhtian Chowk
ARZ OLT-1 to C-14 M-2 Lake City
BTN: OLT-1 to Leads Club Defence Road
JTN OLT-1 to Bahria Orchard (Indoor)
BTN OLT-1 to Near Lead Club
BTN OLT-1 to Near Lead Club
Faisal Town 8067 to Ufone 7123
FZRD: OLT-1 to C-10 Main Chungi Amrsadhu
8057-FZRD (11/0/3) to 7301-Ufone (2/0/2)

And the result should be is as under, thanks a lot for your help:-

C-12 Neelam Block to 8078-AIT (2/0/1)
C-12 Neelam Block to Allama Iqbal town 8078 (2/0/1)
Dream Garden MSAG to 8061 ARZ (11/0/2)
MSAG-56 Jalal Estate Edenabad to 8061 ARZ (2/0/6)
8060-BTN to 8061-ARZ
C04 Hajvery Textile to AliRazabad OLT
C-3/4 Bhobhtian Chowk to 8061-ARZ (11/0/7)
C-14 M-2 Lake City to ARZ OLT-1
Leads Club Defence Road to BTN: OLT-1
Bahria Orchard (Indoor) to JTN OLT-1
Near Lead Club to BTN OLT-1
Near Lead Club to BTN OLT-1
Ufone 7123 to Faisal Town 8067
C-10 Main Chungi Amrsadhu to FZRD: OLT-1
7301-Ufone (2/0/2) to 8057-FZRD (11/0/3)
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Try

Book2
ABC
18078-AIT (2/0/1) to C-12 Neelam BlockC-12 Neelam Block to 8078-AIT (2/0/1)
2Allama Iqbal town 8078 (2/0/1) to C-12 Neelam BlockC-12 Neelam Block to Allama Iqbal town 8078 (2/0/1)
38061 ARZ (11/0/2) to Dream Garden MSAGDream Garden MSAG to 8061 ARZ (11/0/2)
48061 ARZ (2/0/6) to MSAG-56 Jalal Estate EdenabadMSAG-56 Jalal Estate Edenabad to 8061 ARZ (2/0/6)
58061-ARZ to 8060-BTN8060-BTN to 8061-ARZ
6AliRazabad OLT to C04 Hajvery TextileC04 Hajvery Textile to AliRazabad OLT
78061-ARZ (11/0/7) to C-3/4 Bhobhtian ChowkC-3/4 Bhobhtian Chowk to 8061-ARZ (11/0/7)
8ARZ OLT-1 to C-14 M-2 Lake CityC-14 M-2 Lake City to ARZ OLT-1
9BTN: OLT-1 to Leads Club Defence RoadLeads Club Defence Road to BTN: OLT-1
10JTN OLT-1 to Bahria Orchard (Indoor)Bahria Orchard (Indoor) to JTN OLT-1
11BTN OLT-1 to Near Lead ClubNear Lead Club to BTN OLT-1
12BTN OLT-1 to Near Lead ClubNear Lead Club to BTN OLT-1
13Faisal Town 8067 to Ufone 7123Ufone 7123 to Faisal Town 8067
14FZRD: OLT-1 to C-10 Main Chungi AmrsadhuC-10 Main Chungi Amrsadhu to FZRD: OLT-1
158057-FZRD (11/0/3) to 7301-Ufone (2/0/2)7301-Ufone (2/0/2) to 8057-FZRD (11/0/3)
16
RE-ARRANGE TEXT
Cell Formulas
RangeFormula
B1:B15B1=TRIM(REPLACE(A1,1,SEARCH(" to ",A1)+3,"")&" to "&LEFT(A1,SEARCH(" to ",A1)))
 
Upvote 0
For xl 2021 how about
Fluff.xlsm
AB
1
28078-AIT (2/0/1) to C-12 Neelam BlockC-12 Neelam Block to 8078-AIT (2/0/1)
3Allama Iqbal town 8078 (2/0/1) to C-12 Neelam BlockC-12 Neelam Block to Allama Iqbal town 8078 (2/0/1)
48061 ARZ (11/0/2) to Dream Garden MSAGDream Garden MSAG to 8061 ARZ (11/0/2)
58061 ARZ (2/0/6) to MSAG-56 Jalal Estate EdenabadMSAG-56 Jalal Estate Edenabad to 8061 ARZ (2/0/6)
68061-ARZ to 8060-BTN8060-BTN to 8061-ARZ
7AliRazabad OLT to C04 Hajvery TextileC04 Hajvery Textile to AliRazabad OLT
88061-ARZ (11/0/7) to C-3/4 Bhobhtian ChowkC-3/4 Bhobhtian Chowk to 8061-ARZ (11/0/7)
9ARZ OLT-1 to C-14 M-2 Lake CityC-14 M-2 Lake City to ARZ OLT-1
10BTN: OLT-1 to Leads Club Defence RoadLeads Club Defence Road to BTN: OLT-1
11JTN OLT-1 to Bahria Orchard (Indoor)Bahria Orchard (Indoor) to JTN OLT-1
12BTN OLT-1 to Near Lead ClubNear Lead Club to BTN OLT-1
13BTN OLT-1 to Near Lead ClubNear Lead Club to BTN OLT-1
14Faisal Town 8067 to Ufone 7123Ufone 7123 to Faisal Town 8067
15FZRD: OLT-1 to C-10 Main Chungi AmrsadhuC-10 Main Chungi Amrsadhu to FZRD: OLT-1
168057-FZRD (11/0/3) to 7301-Ufone (2/0/2)7301-Ufone (2/0/2) to 8057-FZRD (11/0/3)
Master
Cell Formulas
RangeFormula
B2:B16B2=LET(f,FILTERXML("<k><m>"&SUBSTITUTE(A2," to ","</m><m>")&"</m></k>","//m"),INDEX(f,2)&" to "& INDEX(f,1))
 
Upvote 0
Solution
Hello Team,
Thanks a lot both two formulas working very well and very fast.
Again thanks to this Forum
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
What about this much simpler one?

23 06 06.xlsm
AB
1
28078-AIT (2/0/1) to C-12 Neelam BlockC-12 Neelam Block to 8078-AIT (2/0/1)
3Allama Iqbal town 8078 (2/0/1) to C-12 Neelam BlockC-12 Neelam Block to Allama Iqbal town 8078 (2/0/1)
48061 ARZ (11/0/2) to Dream Garden MSAGDream Garden MSAG to 8061 ARZ (11/0/2)
58061 ARZ (2/0/6) to MSAG-56 Jalal Estate EdenabadMSAG-56 Jalal Estate Edenabad to 8061 ARZ (2/0/6)
68061-ARZ to 8060-BTN8060-BTN to 8061-ARZ
7AliRazabad OLT to C04 Hajvery TextileC04 Hajvery Textile to AliRazabad OLT
88061-ARZ (11/0/7) to C-3/4 Bhobhtian ChowkC-3/4 Bhobhtian Chowk to 8061-ARZ (11/0/7)
9ARZ OLT-1 to C-14 M-2 Lake CityC-14 M-2 Lake City to ARZ OLT-1
10BTN: OLT-1 to Leads Club Defence RoadLeads Club Defence Road to BTN: OLT-1
11JTN OLT-1 to Bahria Orchard (Indoor)Bahria Orchard (Indoor) to JTN OLT-1
12BTN OLT-1 to Near Lead ClubNear Lead Club to BTN OLT-1
13BTN OLT-1 to Near Lead ClubNear Lead Club to BTN OLT-1
14Faisal Town 8067 to Ufone 7123Ufone 7123 to Faisal Town 8067
15FZRD: OLT-1 to C-10 Main Chungi AmrsadhuC-10 Main Chungi Amrsadhu to FZRD: OLT-1
168057-FZRD (11/0/3) to 7301-Ufone (2/0/2)7301-Ufone (2/0/2) to 8057-FZRD (11/0/3)
Swap to
Cell Formulas
RangeFormula
B2:B16B2=MID(A2&" to "&A2,FIND(" to ",A2)+4,LEN(A2))
 
Upvote 0
Thanks a lot Sir,
This is very nice and simple formula,
If I want to match both two coloumns what will be the formula, again thanks
 
Upvote 0
Thanks a lot Sir,
This is very nice and simple formula,
You're welcome. Thanks for the follow-up.

If I want to match both two coloumns what will be the formula, again thanks
If you are still looking for an answer to this please clarify with further explanation and examples as I don't understand what you are wanting.
 
Upvote 0
Thanks a lot Sir Peter_SSs,
I want to match col-A with col-b and then find any duplicate with formula not conditional formatting.
078-AIT (2/0/1) to C-12 Neelam BlockC-12 Neelam Block to 8078-AIT (2/0/1)
Allama Iqbal town 8078 (2/0/1) to C-12 Neelam BlockC-12 Neelam Block to Allama Iqbal town 8078 (2/0/1)
8061 ARZ (11/0/2) to Dream Garden MSAGDream Garden MSAG to 8061 ARZ (11/0/2)
8061 ARZ (2/0/6) to MSAG-56 Jalal Estate EdenabadMSAG-56 Jalal Estate Edenabad to 8061 ARZ (2/0/6)
8061-ARZ to 8060-BTN8060-BTN to 8061-ARZ
AliRazabad OLT to C04 Hajvery TextileC04 Hajvery Textile to AliRazabad OLT
8061-ARZ (11/0/7) to C-3/4 Bhobhtian ChowkC-3/4 Bhobhtian Chowk to 8061-ARZ (11/0/7)
ARZ OLT-1 to C-14 M-2 Lake CityC-14 M-2 Lake City to ARZ OLT-1
BTN: OLT-1 to Leads Club Defence RoadLeads Club Defence Road to BTN: OLT-1
JTN OLT-1 to Bahria Orchard (Indoor)Bahria Orchard (Indoor) to JTN OLT-1
 
Upvote 0
With Peter's formula

Do you want something like?

Book4
ABCD
1078-AIT (2/0/1) to C-12 Neelam BlockC-12 Neelam Block to 8078-AIT (2/0/1)#N/A
2Allama Iqbal town 8078 (2/0/1) to C-12 Neelam BlockC-12 Neelam Block to Allama Iqbal town 8078 (2/0/1)2
38061 ARZ (11/0/2) to Dream Garden MSAGDream Garden MSAG to 8061 ARZ (11/0/2)3
48061 ARZ (2/0/6) to MSAG-56 Jalal Estate EdenabadMSAG-56 Jalal Estate Edenabad to 8061 ARZ (2/0/6)4
58061-ARZ to 8060-BTN8060-BTN to 8061-ARZ5
6AliRazabad OLT to C04 Hajvery TextileC04 Hajvery Textile to AliRazabad OLT6
78061-ARZ (11/0/7) to C-3/4 Bhobhtian ChowkC-3/4 Bhobhtian Chowk to 8061-ARZ (11/0/7)7
8ARZ OLT-1 to C-14 M-2 Lake CityC-14 M-2 Lake City to ARZ OLT-18
9BTN: OLT-1 to Leads Club Defence RoadLeads Club Defence Road to BTN: OLT-19
10JTN OLT-1 to Bahria Orchard (Indoor)Bahria Orchard (Indoor) to JTN OLT-110
11
12
Sheet1
Cell Formulas
RangeFormula
C1:C10C1=MATCH(MID(B1&" to "&B1,FIND(" to ",B1)+4,LEN(B1)),$A$1:$A$10,0)
 
Upvote 0

Forum statistics

Threads
1,215,898
Messages
6,127,628
Members
449,391
Latest member
Kersh82

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