Inserting commas in a variable length text in each cell

bbabine

New Member
Joined
Apr 28, 2002
Messages
47
Hi All,

Looking for how I can insert a comma in three places in the following text that is in one cell. I am trying to parse out specific data from the text, but they content is variable.

Below are a couple of samples of the text that could be in the cell

00:0B:86:66:62:E4NARRAPGr00610.1.1.161135.9.62.109RAP-5WN1/1/21.5/21.5/Yes*Wired Portenable5h:28m:18sdisableRE

00:0B:86:66:BE:D8NARRAPGr19210.1.1.9698.206.44.5RAP-5WN1/6/21.5/21.5/Yes*Wired Portenable5d:17h:23m:22sdisableRE

This is how it would look after the commas are inserted, then I can do a text to column conversion.

00:0B:86:66:62:E4,NARRAPGr00610.1.1.161135.9.62.109RAP-5WN1/1/21.5/21.5/Yes Wired Portenable,5h:28m:18s,disableRE

00:0B:86:66:BE:D8,NARRAPGr19210.1.1.9698.206.44.5RAP-5WN1/6/21.5/21.5/Yes Wired Portenable,5d:17h:23m:22s,disableRE

The variability comes in when there is not only h:m:s, but also d:h:m:s

Any help would be appreciated and would save me tons of time.

Thanks!!
-bbabine
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hello,

If your all cells contains these 3 texts NARRAP, portenable, disable. Try

=SUBSTITUTE(REPLACE(REPLACE(REPLACE(A1,SEARCH("narrap",A1),0,","),SEARCH("portenable",A1)+LEN("portenable"),0,","),SEARCH("disable",A1)+2,0,","),"*"," ")

EDIT; Or

B1,

=REPLACE(A1,SEARCH("narrap",A1),250,"")

B2,

=SUBSTITUTE(REPLACE(A1,SEARCH("portenable",A1)+LEN("portenable"),250,""),B1,"")

B3,

=REPLACE(A1,1,SEARCH("disable",A1)-1,"")
 
Last edited:
Upvote 0
Thanks Haseeb, the first option worked great except on the comma after "portenable", the "e" at the end is after the comma, not before the comma.

I assume that is easy to fix.

thanks!!
-bbabine
 
Upvote 0
Hi

Another option:

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(REPLACE(A1,18,0,","),"*"," "),"Portenable","Portenable,"),"dis",",dis")
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,763
Members
452,940
Latest member
rootytrip

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