ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I changet a text telephone number (xxx) xxx-xxxx to xxxxxx. (https://www.excelbanter.com/excel-worksheet-functions/158808-how-do-i-changet-text-telephone-number-xxx-xxx-xxxx-xxxxxx.html)

Bayou Johnny

How do I changet a text telephone number (xxx) xxx-xxxx to xxxxxx.
 
I have a data export that lists telephone number in a (xxx) xxx-xxxx format
that I need to change to a number format without spaces or commas. Anyone
know of a formula to apply to a column of text numbers to make such a
conversion within a spreadsheet?

Don Guillett

How do I changet a text telephone number (xxx) xxx-xxxx to xxxxxx.
 
You could use a nested SUBSTITUTE formula or use edit/replace, or a macro
to do it for you.

Sub fixphonenumbers()
With Range("e1:e10")
.Replace "(", ""
.Replace ")", ""
.Replace " ", ""
.Replace "-", ""
End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Bayou Johnny" wrote in message
...
I have a data export that lists telephone number in a (xxx) xxx-xxxx format
that I need to change to a number format without spaces or commas. Anyone
know of a formula to apply to a column of text numbers to make such a
conversion within a spreadsheet?



Michael Bowers

How do I changet a text telephone number (xxx) xxx-xxxx to xxxxxx.
 
Try this formula:

=VALUE(TRIM(CLEAN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE (SUBSTITUTE(A1,"(",""),")",""),"-","")," ",""))))

or...

Save this function to your PERSONAL.xls file in a module:

Function KeepNumeric(Text As String) As String
Dim sTemp As String, i As Integer
sTemp = Text
For i = 1 To 255
If i < 48 Or i 57 Then
sTemp = Application.Substitute(sTemp, Chr(i), "")
End If
Next i
KeepNumeric = sTemp
End Function

Then enter the formula: =Value(KeepNumeric(A1))

That should do it!

Thanks,
Mike

"Bayou Johnny" wrote:

I have a data export that lists telephone number in a (xxx) xxx-xxxx format
that I need to change to a number format without spaces or commas. Anyone
know of a formula to apply to a column of text numbers to make such a
conversion within a spreadsheet?



All times are GMT +1. The time now is 11:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com