Splitting Text by different delimiters

Peter Davison

Active Member
Joined
Jun 4, 2020
Messages
437
Office Version
  1. 365
Platform
  1. Windows
I have the following excel cell formula

=IFERROR(MID($A14,IF(COLUMN()=2,1,SUMPRODUCT(LEN(A14:$B14))+COLUMN(A14)),FIND($B$3,RIGHT($A14,LEN($A14)-IFERROR(FIND($B$3,$A14,IF(COLUMN()=2,1,SUMPRODUCT(LEN(A14:$B14))+COLUMN(A14))-1),0))&$B$3)-1),"")

It looks at Cell B3 to determine the delimiter (e.g. a comma ,)

As my original data may have both a comma , or a dash (or maybe something different but lets say 2 for now) - is there a way of changing the formula above to look at two cells with different delimiters and then split accordingly? (e.g. Cells B3 and C3)

Thanks for your help
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
No problem.
This is what needs splitting

Wholesale;FRESH;MEALSOLS&SNACKING;FRESH-MEALSOLS&SNACKING-TRIAL-11250H.WSL
Wholesale;FRESH;MEALSOLS&SNACKING;FRESH-MEALSOLS&SNACKING-TRIAL-11250H.WSL
Wholesale;FRESH;MEAL SOLUTIONS;FRESH-MEALSOLS-TRIAL-10937H.NEW

Using the formula above it will only split with the semi colon ; which is in cell B3
So the result is -

WholesaleFRESHMEALSOLS&SNACKINGFRESH-MEALSOLS&SNACKING-TRIAL-11250H.WSL
WholesaleFRESHMEALSOLS&SNACKINGFRESH-MEALSOLS&SNACKING-TRIAL-11250H.WSL
WholesaleFRESHMEAL SOLUTIONSFRESH-MEALSOLS-TRIAL-10937H.NEW

What I needed it to do is be able to split with a second option say the dash - or a third option the dot .

Any thoughts?
Thanks for you time
 
Upvote 0
You can have few nested substitutes to handle the delimiters you need. Copy down and across.

=TRIM(MID(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(";"&$A2,";",REPT(" ",99)),"-",REPT(" ",99)),".",REPT(" ",99)),COLUMNS($A$1:A$1)*99,99))
 
Upvote 0
How about
+Fluff 1.xlsm
ABCDEFGH
1
2
3;-
4
5Wholesale;FRESH;MEALSOLS&SNACKING;FRESH-MEALSOLS&SNACKING-TRIAL-11250H.WSLWholesaleFRESHMEALSOLS&SNACKINGFRESHMEALSOLS&SNACKINGTRIAL11250H.WSL
6Wholesale;FRESH;MEALSOLS&SNACKING;FRESH-MEALSOLS&SNACKING-TRIAL-11250H.WSLWholesaleFRESHMEALSOLS&SNACKINGFRESHMEALSOLS&SNACKINGTRIAL11250H.WSL
7Wholesale;FRESH;MEAL SOLUTIONS;FRESH-MEALSOLS-TRIAL-10937H.NEWWholesaleFRESHMEAL SOLUTIONSFRESHMEALSOLSTRIAL10937H.NEW
8
Lists
Cell Formulas
RangeFormula
B5:H7B5=TRANSPOSE(FILTERXML("<k><m>"&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A5,$C$3,"</m><m>"),$B$3,"</m><m>"),"&","&amp;")&"</m></k>","//m"))
Dynamic array formulas.
 
Upvote 0
Solution
Fantastic result.
Thanks to everyone.
Your all brilliant.
It only let me mark one with a tick.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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