+ Start a Discussion
SeannoSeanno 

Convert Phone # with () to just a number value

I'm trying to use a field update to bring out a phone number from a "Fax" field, and convert it to just a numerical sequence.  Could find a formula that would do this in the formula editor.   For example I want to convert fax # (818) 555-1212 into 8185551212, and add it onto an email.  Is there a formula that will take this string and remove the () and spaces?  So far I've done this:

 

"1"&FAX&"@concordsend.com"

 

Which gives me 1(818) 555-1212@concordsend.com.

I want: 18185551212@concordsend.com

 

Thanks,

 

Sean

Best Answer chosen by Admin (Salesforce Developers) 
DeBoLoDeBoLo

HI,

 

This will help you. I just created this and tested it, working fine. Try once at your end.

 

SUBSTITUTE( SUBSTITUTE( SUBSTITUTE( SUBSTITUTE( SUBSTITUTE(Phone, '.', '')  , ' ', '')  , '-', '')  , ')', '')  , '(', '')

 

This will remove (, ), -, space, dot

 

Thanks

All Answers

forcedotcomforcedotcom

You want to use the TRIM() formula function to get rid of the spaces, and SUBSTITUTE() to remove the (, ) and - like:

 

AND(

SUBSTITUTE(Fax, "(", null),

SUBSTITUTE(Fax, ")", null),

SUBSTITUTE(Fax, "-", null),

TRIM(Fax)

)

 

(I've not tested this so it may not produce the exact results you're looking for but hope it helps)

DeBoLoDeBoLo

HI,

 

This will help you. I just created this and tested it, working fine. Try once at your end.

 

SUBSTITUTE( SUBSTITUTE( SUBSTITUTE( SUBSTITUTE( SUBSTITUTE(Phone, '.', '')  , ' ', '')  , '-', '')  , ')', '')  , '(', '')

 

This will remove (, ), -, space, dot

 

Thanks

This was selected as the best answer
Iain ClementsIain Clements
Just what I was looking for - many thanks