Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Numbers: how to remove phone number formatting

Is there any way to remove phone number formatting from a cell in Numbers?


I have nearly 100 separate files of contact information. I can bring the files in from a text delimited file (Excel, cvs, etc.)


The phone numbers in those files are formatted in every way imaginable (999) 999-9999, 999-999-9999, 999.999.9999, etc. I'd like to strip that formatting out so I get the just the numbers: 9999999999. My intent is just to use Numbers temporarily to strip out the phone number formating before bringing the data into the 4D database program.


Someone is selling a $29 formula for Excel to do this, but then I'd have to buy Excel again--my old version of Excel doesn't work in my latest version of the Mac OS. I can strip the phone number formatting out in 4D, but I'm not a programmer and it is complicated.

Posted on Jul 24, 2012 1:10 PM

Reply
Question marked as Best reply

Posted on Jul 24, 2012 2:12 PM

Manually:

search for "-" and replace with nothing

search for "(" and replace with nothing

search for ")" and replace with nothing

search for "." and replace with nothing

User uploaded file


You could also make a table that allows you to paste in the phone numbers in their various forms and have a cell with a formula that replces the offending characters with nothing:


User uploaded file


B1=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,".",""),")",""),"(" ,"")," ",""),"-","")



this repeatedly substitutes various characters in your offending list (".", "-", " ", "(", ")") with nothing.


The last way is to use a script of some kind to make the substitution.

12 replies
Question marked as Best reply

Jul 24, 2012 2:12 PM in response to MikeM.

Manually:

search for "-" and replace with nothing

search for "(" and replace with nothing

search for ")" and replace with nothing

search for "." and replace with nothing

User uploaded file


You could also make a table that allows you to paste in the phone numbers in their various forms and have a cell with a formula that replces the offending characters with nothing:


User uploaded file


B1=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,".",""),")",""),"(" ,"")," ",""),"-","")



this repeatedly substitutes various characters in your offending list (".", "-", " ", "(", ")") with nothing.


The last way is to use a script of some kind to make the substitution.

Jul 24, 2012 4:22 PM in response to MikeM.

I think you would need to provide the general format of the data like:

- how many columns

- how the columns are delimited


the list of characters you want to remove before we can help. Since there is 100 files I think a shell script (or applescript) is the best solution.


I demonstrated how to modify one column using Numbers you can simply reference the other columns directly like:

User uploaded file

In the bottom table enter the following formulas:

A1=Original data :: A1

B1=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Original data :: B1,".",""),")",""),"(","")," ",""),"-","")

C1=Original data :: C1

D1=Original data :: D1


select A1 thru D1 and fill down as needed


Copy modified data out of the bottom table (shrewdly named "Modified only phone Numbers"), paste into a new table by using the menu item "Edit > Paste Values".


Then paste new data in the top table and repeat

Jul 24, 2012 9:09 PM in response to Wayne Contello

Wayne, I'm blown away that you spent so much time helping on this. Really blown away.


Here's some more questions:


--On the search and replace, is there any way to limit the search area to one column?


--I wrote up that simplified post before I realized you had replied and then it took me a little while to go through what you did to see if it would work for me. The formula definitely works. Well, I should say, I can get it to work with one cell. What I can't seem to figure out how to apply it to multiple rows or apply it the whole column. (If I select muliple rows--say B1 to B6, I'm no longer able to enter a function.) I think you're trying to explain it in the 4:22 pm post, but I don't quite get it.


By the way, the files will come in once a week or so, from different sources, so I won't know what I'm getting until each file arrives. I'm just trying to figure this out now so I do the work quicker when it comes in. Each file will probably have 400-1200 records, with 3 sets of phone numbers (home, work, and mobile) to change.

Jul 24, 2012 10:47 PM in response to MikeM.

to apply to the whole column enter tha original formula in cell B1 as:


B1=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,".",""), ")",""),"(" ,"")," ",""),"-","")


then select A1, then grah (click and hold the little circle at the bottom right of the selection) and drag straight down to fill the formula as needed, then release te mouse button. Numbers will adjust the cell reference automatically.



The other method is to enter the formula in B1 as described above. Then select B1, then copy, then select B2, the shift click the and of column B, then paste.

Jul 24, 2012 11:40 PM in response to Wayne Contello

"The other method is to enter the formula in B1 as described above. Then select B1, then copy, then select B2, the shift click the and of column B, then paste."


Even easier, if you want to fill the formula into the whole column is to:


Enter the formula in B1 as described, then select B1 and Copy.

Then click the column B reference tab to select the whole column, then paste.


Regards,

Barry

Numbers: how to remove phone number formatting

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.