Here's a link, though I don't think it would do much. https://docs.google.com/spreadsheets/d/1-tjCZe6JTt-f4gEYISc5-pDvum_pILJIOK5T1vF1utc/edit?usp=sharing
There's two things that needs to happen: format and data cleaning. First format.
I don't think there is a built-in format for phone numbers (but I could be wrong), so we make our own. Select your column, go to your menus > Format > Number > Custom Number Format. You'll see a place where you can input things. enter in 000-000-0000
. This will format numbers and numbers only into this format. ###-###-####
is probably the more correct form, but I prefer 000-000-0000
because it adds leading zeroes. But choose which one works better for you.
Now for data cleaning. The best way I could figure is to use replace with regex. press Ctrl + H
and check the 'Search using regular expressions'. Set the search to specific range and set it to the column of phone numbers, because this method can be very invasive. in the find field input [()\- ]
. This is a regex pattern that will find all parentheses, dashes, and spaces. Keep the replace field blank. Then just to be safe, replace one at a time.
That should do it. But if you are willing to play around with AppScript, you can take this code of mine that I first thought of when answering.
function onOpen() {
menu = SpreadsheetApp.getUi().createMenu("⚙️ Custom")
.addItem("Fix all selected phone numbers", "numberFixer")
.addToUi()
}
function numberFixer() {
const activeSheet = SpreadsheetApp.getActiveSheet();
const selection = activeSheet.getSelection().getActiveRange();
const selectionValue = selection.getValues();
for (let i = 0; i < selectionValue.length; i++) {
for (let j = 0; j < selectionValue[i].length; j++) {
const currentCellValue = selectionValue[i][j];
if (typeof currentCellValue === 'string' && !currentCellValue.match(/\w/g) && currentCellValue !== '') {
selection.getCell(i + 1, j + 1)
.setValue(currentCellValue.replace(/[()\- ]/g, ''))
.setNumberFormat("000-000-0000");
}
}
}
}
This will create a custom menu that contains a function. When the function is run, it will remove all parentheses, dashes, and spaces if the cell doesn't contain any letters. Afterwards, it will format the cell to a phone number.