How to split text

Abdmujib

Board Regular
Joined
May 15, 2022
Messages
123
Office Version
  1. 2021
Platform
  1. Windows
Hello,

Please how can I split these strings with a common delimiter, the common Delimiter is "-", So I have difficulty in splitting it using Left, Right, Search functions because in some cases like B4 and B6 the delimiter appears twice leaving. so for case of B6 it will split it at the first "-" instead of the Second. Is there a way to go about it.

Note: the only thing that is common again is that there is are always three uppercase string before the "-". but my version does not support Regex.

Kindly help me out

1727195387167.png
 
Try

Book1
ABCDE
1
2TeamsHomeAway
3Anioly TorunAni-Bas BialystokBASAnioly TorunAniBas BialystokBAS
4Astra Nowa SoIAST-B-BialaBBBAstra Nowa SoIASTB-BialaBBB
5KS RudziniecRUD-Wks Czarni RadomWKSKS RudziniecRUDWks Czarni RadomWKS
6Avia-SwidnikAVI-McKis Energetyk JaworznoMCKAvia-SwidnikAVIMcKis Energetyk JaworznoMCK
7KS Lechia Tomaszow MazowieckiLEC-SiedlceSIEKS Lechia Tomaszow MazowieckiLECSiedlceSIE
8
9
10
Sheet3
Cell Formulas
RangeFormula
C3:C7C3=IFERROR(LEFT(B3,MAX(AGGREGATE(15,6,FIND(CHAR(ROW($65:$90))&"-",B3),1),AGGREGATE(15,6,FIND("-"&CHAR(ROW($65:$90)),B3),1)-1)),LEFT(B3,AGGREGATE(15,6,FIND("-"&CHAR(ROW($65:$90)),B3),1)-1))
D3:D7D3=IFERROR(MID(B3,MAX(AGGREGATE(15,6,FIND(CHAR(ROW($65:$90))&"-",B3),1),AGGREGATE(15,6,FIND("-"&CHAR(ROW($65:$90)),B3),1)-1)+2,99),MID(B3,AGGREGATE(15,6,FIND("-"&CHAR(ROW($63:$88)),B3),1)+1,99))
Wow Thank you so much.

It worked for all the examples I gave. but I went through the formula to understand how it works in case I come across another scenario in the future.

for Data in the picture attached, it was unable to separate it very well. is it possible you look for 3 Capital Letters follow by "-"

1727206588838.png


Thank you so much
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
instead of posting as picture, can you post your data using xl2bb? if that is not possible then just copy paste here as text.
 
Upvote 0
instead of posting as picture, can you post your data using xl2bb? if that is not possible then just copy paste here as text.
okay
B-BialaBBB-KS RudziniecRUD
Anioly-TorunANI-Bas BialystokBAS
B-BialaBBB-KS Arka Tempo ChelmARK
 
Upvote 0
Try

How to Split text AGGREGATE FIND.xlsx
ABCD
1TeamsHomeAway
2Anioly TorunAni-Bas BialystokBASAnioly TorunAniBas BialystokBAS
3Astra Nowa SoIAST-B-BialaBBBAstra Nowa SoIASTB-BialaBBB
4KS RudziniecRUD-Wks Czarni RadomWKSKS RudziniecRUDWks Czarni RadomWKS
5Avia-SwidnikAVI-McKis Energetyk JaworznoMCKAvia-SwidnikAVIMcKis Energetyk JaworznoMCK
6KS Lechia Tomaszow MazowieckiLEC-SiedlceSIEKS Lechia Tomaszow MazowieckiLECSiedlceSIE
7B-BiaLaBBB-KS RudziniecRUDB-BiaLaBBBKS RudziniecRUD
8Anioly-TorunANI-Bas BialystokBASAnioly-TorunANIBas BialystokBAS
9B-BialaBBB-KS Arka Tempo ChelmARKB-BialaBBBKS Arka Tempo ChelmARK
10
11
Sheet4
Cell Formulas
RangeFormula
B2:B9B2=IF(IF(SUM(--EXACT(CHAR(ROW($65:$90)),LEFT(MID(A2,SEARCH("???-",A2),3))),--EXACT(CHAR(ROW($65:$90)),MID(MID(A2,SEARCH("???-",A2),3),2,1)),--EXACT(CHAR(ROW($65:$90)),RIGHT(MID(A2,SEARCH("???-",A2),3),1)))=3,MID(A2,SEARCH("???-",A2),3),"")="",IFERROR(LEFT(A2,MAX(AGGREGATE(15,6,FIND(CHAR(ROW($65:$90))&"-",A2),1),AGGREGATE(15,6,FIND("-"&CHAR(ROW($65:$90)),A2),1)-1)),LEFT(A2,AGGREGATE(15,6,FIND("-"&CHAR(ROW($65:$90)),A2),1)-1)),LEFT(A2,FIND(IF(SUM(--EXACT(CHAR(ROW($65:$90)),LEFT(MID(A2,SEARCH("???-",A2),3))),--EXACT(CHAR(ROW($65:$90)),MID(MID(A2,SEARCH("???-",A2),3),2,1)),--EXACT(CHAR(ROW($65:$90)),RIGHT(MID(A2,SEARCH("???-",A2),3),1)))=3,MID(A2,SEARCH("???-",A2),3),""),A2)+2))
C2:C9C2=IF(IF(SUM(--EXACT(CHAR(ROW($65:$90)),LEFT(MID(A2,SEARCH("???-",A2),3))),--EXACT(CHAR(ROW($65:$90)),MID(MID(A2,SEARCH("???-",A2),3),2,1)),--EXACT(CHAR(ROW($65:$90)),RIGHT(MID(A2,SEARCH("???-",A2),3),1)))=3,MID(A2,SEARCH("???-",A2),3),"")="",IFERROR(MID(A2,MAX(AGGREGATE(15,6,FIND(CHAR(ROW($65:$90))&"-",A2),1),AGGREGATE(15,6,FIND("-"&CHAR(ROW($65:$90)),A2),1)-1)+2,99),MID(A2,AGGREGATE(15,6,FIND("-"&CHAR(ROW($65:$90)),A2),1)+1,99)),MID(A2,FIND(IF(SUM(--EXACT(CHAR(ROW($65:$90)),LEFT(MID(A2,SEARCH("???-",A2),3))),--EXACT(CHAR(ROW($65:$90)),MID(MID(A2,SEARCH("???-",A2),3),2,1)),--EXACT(CHAR(ROW($65:$90)),RIGHT(MID(A2,SEARCH("???-",A2),3),1)))=3,MID(A2,SEARCH("???-",A2),3),""),A2)+4,99))
 
Upvote 1
Solution
Another Alternative to the Answer

The Answer works Well and I will be making use of it. but for people that don't like complex formula, you can actually use Power Pivot to split it.
You will have to manipulate your data in the power pivot using

split by Uppercase to Lower or Split by Lower case to Upper, Merge and Split by number of Characters. You will manipulate it until you achieve a desired Results.


The raw data to be imported
1727250850977.png


Below is the Picture of the Power Query interface and the Applied Steps

1727250758657.png


The desired result

1727250981969.png
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

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