# Re: Need help with Substitute/If

536 0
cancel
Showing results for
Did you mean:
4 - Data Explorer

Hello people, hope you can help me to solve my problem.

I’m currently using a formula to substitute some character for cleaning my cell :

SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Telephone,".","")," “,”"),"-",""),"(",""),")","")

and after this step , i’m using an other formula :

IF(LEFT(Telephone,1)!=“0”,CONCATENATE(“0”,Telephone),Telephone)

it works perfectly but the question is : how can i do the same thing in one formula ?

For exemple :

(06-07-45)43.56 26 i want 060745435626
(6-07-45)43.56 26 i want 060745435626

Sorry for my english, i’m french :grinning_face_with_smiling_eyes: and thank you for your answers.

3 Replies 3
16 - Uranus

Simplify your formula by using REGEX to remove “everything that’s not a digit” (`[^\\d]`)

``````IF(
LEFT(REGEX_REPLACE(Telephone, "[^\\d]", ""), 1) != "0",
"0"
) & REGEX_REPLACE(Telephone, "[^\\d]", "")
``````

^ the above could probably be written more efficiently with a single line of REGEX, but the above will work.

4 - Data Explorer

It’s perfect ! Thank you a lot !

4 - Data Explorer

thanks my issue has been fixed.