Skip to content

Instantly share code, notes, and snippets.

@fxchen
Created November 30, 2012 00:43
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fxchen/4172968 to your computer and use it in GitHub Desktop.
Save fxchen/4172968 to your computer and use it in GitHub Desktop.
This Excel Formula helps format phone numbers on Google Contacts. If your gmail contacts are unorganized mess like mine used to be.
How to Clean Up Google Contact Numbers
If your Gmail contact phone numbers are unorganized, this Excel formula can help you remove format the mobile phone numbers.
Note: I added a 1 for US numbers. I like my numbers formatted this way.
1. Export the numbers you want to clean to CSV (Use Google CSV)
2. Open in Excel. The U2 column was Mobile Phone column for the file I downloaded.
3. Place this formula starting in the V2 column (this will replace the Pager column, which I did not need) and copy downwards to do the same formula replacement.
=IF((LEFT(U2,0,1)="1"),SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(U2," ",""),".",""),")",""),"(",""),"-",""),CONCATENATE("1",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(U2," ",""),".",""),")",""),"(",""),"-",""))
4. Copy from V2 (downwards) and do a Paste Special starting on U2 with "Value". This will replace your previous values for mobile phone with the clean ones.
5. Save.
6. Delete the contacts you exported on Google Contacts. Import your fresh CSV. #win
Pseudocode:
=IF((LEFT(U2,0,1)="1"), # If the number starts with 1
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(U2," ",""),
".",""), # Remove period
")",""), # Remove right paren
"(",""), # Remove right paren
"-","") # Remove dash
, # Else number does not have 1
CONCATENATE("1", #Concatenate 1
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(U2," ",""),
".",""), # Remove period
")",""), # Remove right paren
"(",""), # Remove right paren
"-","") # Remove dash
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment