Format phone numbers

Any on have eyes on formula to format a number? It’s a phone number column and I need all of the numbers to be in (###) ###-#### format. Any help is always appreciated.

Like this ? @Snapper_Cridge
(Assuming you enter the number in your table as one column :slightly_smiling_face: )

This is great, could you help advising in how to add the country code as well?
+1
for example.

Thanks!

Hi there @Ivo_Ezeta !

Sorry to get back at you so late :confused: !

Just in case you were still wondering about this, here is how I would add Country Code +1 to this :wink: .

I’ve also added another solution if other countries are needed too :wink: .

3 Likes

Looking to do the opposite and remove all parenthesis. Any guesses?

Depending how the phone number is originally entered in the table (I assume it was in a Text field here) but I’ve got this :blush: :
(The formula in Number might need some adjustments, depending on what your phone number actually looks like :wink: )

There might be other ways to get to that result too.

1 Like

Dear @Snapper_Cridge,

This post might also be of your interest

Credits to @Al_Chen_Coda

4 Likes

For the sake of simplicity, to “de-pattern” numbers there is an even easier solution:

[Formatted Number].RegexReplace("[^0-9]", "")

Which - literally - takes out every non number char.

As a hint, every time there is some string manipulation, take into consideration that RegexpMatch() and RegexpReplace() are very powerful and (usually) more efficient.
The drawback is to learn a bit of their syntax, but it worths doing it in the long term.

5 Likes

Thanks Frederico :grin: ! I’m gonna add this to the doc I shared :wink:.

I thought about using Regex but I didn’t had the time to look there :confused:.

(I’ve played around with RegexMatch() and RegexReplace() in the past, and I fully agree with you here about the efficiency, but it was some time ago and I didn’t got the chance, yet, to explore those formulas again :innocent: )

3 Likes

@Federico_Stefanato @Pch Thank you! Very streamlined solution and works perfectly!