Textsplit loses Delimiter

pto160

Well-known Member
Joined
Feb 1, 2009
Messages
505
Office Version
  1. 365
Platform
  1. Windows
I am trying to split text by a delimiter, but I want the delimiter to remain. It does not seem to work. I want the text to split text by "CZ" in this example.
Is there a way to do this?

Book3
AB
2CZ DOG ER CZ DOG EE CZ CAT ER CZ CAT EE CZ SNAKE EE CZ SNAKE ER CZ HOUSE EE CZ HOUSE ER 
3 DOG ER
4 DOG EE
5 CAT ER
6 CAT EE
7 SNAKE EE
8 SNAKE ER
9 HOUSE EE
10 HOUSE ER
11
12What I like
13CZ DOG ER
14CZ DOG EE
15CZ CAT ER
16CZ CAT EE
17CZ SNAKE EE
18CZ SNAKE ER
19CZ HOUSE EE
20CZ HOUSE ER
Sheet2
Cell Formulas
RangeFormula
B2:B10B2=TEXTSPLIT(A2,,"CZ")
Dynamic array formulas.
 
Or try this.
Excel Formula:
=TEXTSPLIT(TEXTJOIN("",,SUBSTITUTE(A2:A3,LEFT(A2:A3,2),"|" & LEFT(A2:A3,2))),,"|",TRUE)
CONCAT( is specifically designed to do TEXTJOIN("", ,...

So
Excel Formula:
=TEXTSPLIT(CONCAT(SUBSTITUTE(A2:A3,LEFT(A2:A3,2),"|" & LEFT(A2:A3,2))),,"|",TRUE)
or
Excel Formula:
=LET(a,A2:A3,d,LEFT(a,2),TEXTSPLIT(CONCAT(SUBSTITUTE(a,d,"|"&d)),,"|",TRUE))
 
Upvote 0
Peter_SSs, thanks so much for that solution. It works great. :) (y)
 
Upvote 0

Forum statistics

Threads
1,226,771
Messages
6,192,919
Members
453,767
Latest member
922aloose

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