How to remove special characters from a cell

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,226
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
In coulumn C, the value is a text which contains Starting with 2 digit alphabets, separated by ONE special character "/" or "-", then 4 to 8 digit numericals then again separated by ONE special character "/" or "-", then 2 to 3 digit numericals.

Output required in column D = All text without special characters
and in column E = last numerical value (of 2 to 3 digit numericals)
and in column F = above last numerical value prefixed with a 0.
Note: blanks are not to considered
Ex:
cell C4=MH / 456789 - 187
cell D4=MH456789187
cell E4=0187

cell C4=YH / 1237 - 000
cell D4=MH1237000
cell E4=0000
 
How to get second part without prefixing 0?
There are some values in the columns starting with DE:DH. Answers will be in DI, DJ & DK.
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Sorry, I completely misread what you wanted for that first part. Sal Paradise gave you a working formula for the first part.

First Part: =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(D4,"/",""),"-","")," ","")

Last Part: =0&TRIM(RIGHT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(DD4,"-"," "),"/"," ")," ",REPT(" ",25)),25))

First Part. OK
Second Part (by removing 0& from the 'Last Part' formula) is giving answer 6 for Data in DD4=MH / 123456 / 148. CORRECT answer=12346. How to get?
Please remember the answer cells are in column DI, DJ & DK. There are values in columns DE, DF, DG & DH.
 
Upvote 0
First Part. OK
Second Part (by removing 0& from the 'Last Part' formula) is giving answer 6 for Data in DD4=MH / 123456 / 148. CORRECT answer=12346. How to get?
Please remember the answer cells are in column DI, DJ & DK. There are values in columns DE, DF, DG & DH.

If you could download the HTML maker in my signature and show us your sample data along with what answers you expect on a bigger sample set (maybe 20 lines?) it would help us understand the problem.

It seems like the request is changing from what you originally wanted, so please let us know what you're after.
 
Upvote 0
I punched the "Data" in DD4 as DD4=MH / 123456 / 148.
Then copy pasted your formulas in DI4, DJ4 & DK4 to get First answer, Second answer & Third answer.
First answer is CORRECT.
But Second answer & Third answer is wrong.

CORRECT Second answer=148. How to get?
Correct Third answer=0148. How to get?

There are some arbitrary values in columns DE4, DF4, DG4 & DH4.
 
Upvote 0
It works. Can I get the value before FIRST "/" or "-"? Here "MH ". There is 1 blank after MH since MH / 123456 / 148. Also, then, in another cell without blank (if any) i.e. only MH in this case.
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

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