How do I strip out all non-numeric characters?

exceltm

New Member
Joined
Apr 5, 2010
Messages
32
How do I strip out all non-numeric characters?

I have 10,000 phone numbers, of which people entered in different formats, such as
212.123.1234
212 123 1234
212-123-1234
(212)123-1234

How do I strip out ALL the data/characters that are NOT numbers so the result is

2121231234

I want all my phone numbers to be consistent. I can individually FIND and REPLACE the .()- and spaces with "" nothing but sometimes there remain hidden characters after the 10 numbers. I know this from doing a =LEN(A1) and it reports 11, even though I see only 10 numbers. If I highlight the field and hit delete at the end of the 10 numbers, it deletes SOMETHING which is invisible and takes the length to 10 numbers as it should be.

So, how do I strip out ALL the data/characters that are NOT numbers so the result is only the 10 numbers?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Another way if you have Morefunc:

Excel Workbook
AB
1212.123.12342121231234
2212 123 12342121231234
3212-123-12342121231234
4(212)123-12342121231234
example
Excel 2003
#VALUE!
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}. Note: Do not try and enter these manually yourself
 
Upvote 0
I'm rather keen on this formula courtesy of Ron Coderre:
Excel Workbook
AB
24212.123.12342121231234
Sheet1
Excel 2002
Cell Formulas
RangeFormula
B24=SUMPRODUCT(MID(0&A24,LARGE(INDEX(ISNUMBER(--MID(A24,ROW($1:$25),1))* ROW($1:$25),0),ROW($1:$25))+1,1)*10^ROW($1:$25)/10)
 
Upvote 0
I'm rather keen on this formula courtesy of Ron Coderre:

Excel Workbook
AB
24212.123.12342121231234
Sheet1
Excel 2002
Cell Formulas
RangeFormula
B24=SUMPRODUCT(MID(0&A24,LARGE(INDEX(ISNUMBER(--MID(A24,ROW($1:$25),1))* ROW($1:$25),0),ROW($1:$25))+1,1)*10^ROW($1:$25)/10)

Wow :eek:
One for the favourites list. (y)
 
Upvote 0
regexp seems to be one of the best option to remove all type non-numeric characters.
 
Upvote 0
This works perfectly except for when the cell is blank/empty, it returns a value of zero/0.

THanks to all for the superfast replies. My skill level is beginner.

I'm rather keen on this formula courtesy of Ron Coderre:

Excel Workbook
AB
24212.123.12342121231234
Sheet1
Excel 2002
Cell Formulas
RangeFormula
B24=SUMPRODUCT(MID(0&A24,LARGE(INDEX(ISNUMBER(--MID(A24,ROW($1:$25),1))* ROW($1:$25),0),ROW($1:$25))+1,1)*10^ROW($1:$25)/10)
 
Upvote 0
You could test for that in an IF statement:

=IF(A1="","",SUMPRODUCT(MID(0&A1,LARGE(INDEX(ISNUMBER(--MID(A1,ROW($1:$25),1))*
ROW($1:$25),0
),ROW($1:$25)
)+1,1
)*10^ROW($1:$25)/10
))
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,383
Members
448,956
Latest member
JPav

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