To clean phone numbers in Excel, you need to remove everything that is not a digit, then optionally format the result consistently. The quickest method is to use a formula: =TEXTJOIN("",TRUE,IFERROR(MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1)*1,"")) entered as an array formula (Ctrl+Shift+Enter in older Excel versions), or use Power Query to strip non-numeric characters. This achieves a uniform list of digits you can dial, import, or compare without stray spaces, parentheses, dashes, or country codes getting in the way. Before you start, make a backup copy of your worksheet, because cleaning overwrites or replaces the original data.
What You'll Need
- Microsoft Excel (any recent version; steps may vary slightly by version and platform).
- A column of phone numbers to clean (one number per cell).
- A spare column for the cleaned results (do not overwrite the original until you have verified the output).
- Optional: Power Query (built into Excel 2016 and later) for a repeatable, formula-free approach.
Step-by-Step
- Back up your data. Save a copy of the workbook or duplicate the sheet (right-click the sheet tab and choose Move or Copy, then tick Create a copy). This lets you recover if a formula or replace operation goes wrong.
- Inspect the numbers. Look for common junk: spaces, hyphens, parentheses, dots, plus signs, leading apostrophes, text formatting, and country codes. Also check for blank cells and numbers stored as text versus numbers. Knowing what you are removing helps you choose the right method.
- Choose your cleaning method. For a one-off clean, use a formula in a helper column. For a repeatable process, use Power Query. Both are covered below.
- Method A: Formula approach. In a blank column next to your data (say B2), enter this formula to keep only digits:
=TEXTJOIN("",TRUE,IFERROR(MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1)*1,"")). In Excel 365 or Excel 2021, press Enter; in older versions, press Ctrl+Shift+Enter to make it an array formula. Drag the fill handle down to apply to all rows. This works because multiplying each character by 1 returns a number for digits and an error for anything else, which IFERROR then blanks out. - Method B: Power Query approach. Select your data range, go to the Data tab, and click From Table/Range. In the Power Query Editor, select the phone column, then go to Add Column > Extract > Text Between Delimiters or use a custom column with
Text.Select([Phone], {"0".."9"}). This keeps only digits. Then remove the original column, rename the new one, and click Close & Load to return the cleaned data to Excel. - Check for leading zeros. If your numbers include leading zeros (common in some countries), the formula approach will drop them because Excel treats the result as a number. To preserve leading zeros, format the helper column as Text before applying the formula, or prefix the result with an apostrophe. Alternatively, use Power Query and set the column type to Text.
- Handle country codes and extensions. Decide whether to keep or remove country codes (e.g., +1) and extensions. For a uniform list, you might strip the country code if all numbers are domestic. Use
RIGHT,LEFT, orMIDfunctions, or Power Query's Text After Delimiter, to remove unwanted prefixes or suffixes. Be careful not to cut off valid digits. - Validate the results. Compare a sample of cleaned numbers against the originals. Check that the digit count is consistent (e.g., 10 digits for US numbers). Use
=LEN(B2)to count characters and flag anomalies. Also look for numbers that became blank because they contained no digits. - Replace the original data (optional). Once satisfied, copy the cleaned column and paste it over the original as values (Paste Special > Values). Then delete the helper column. Keep your backup until you are sure.
- Format for display (optional). If you want a consistent look, apply a custom number format such as
(###) ###-####for US numbers. Remember that formatting does not change the underlying digits, only how they appear.
Common Mistakes
- Overwriting the original data without a backup. Always work in a copy or helper column first.
- Losing leading zeros. Excel drops leading zeros when a result is treated as a number. Format as Text or use Power Query to preserve them.
- Assuming all numbers have the same format. Mixed formats (some with country codes, some without) can produce inconsistent results. Normalize before cleaning.
- Using Find & Replace carelessly. Replacing spaces or dashes globally can affect other columns. Restrict the operation to the phone column.
- Forgetting about extensions. Numbers with extensions (e.g., x123) will have the extension digits merged into the main number if you strip all non-digits. Remove extensions first if you do not want them.
- Not checking for hidden characters. Non-breaking spaces or other invisible characters may survive simple cleaning. Use
CLEANandTRIMfunctions or Power Query to remove them.
Tips
- Use
TRIMandCLEANbefore extracting digits to remove extra spaces and non-printable characters. - For a quick visual check, use conditional formatting to highlight cells that do not match your expected digit count.
- If you frequently clean phone numbers, save your Power Query steps as a reusable query or create a macro.
- When sharing the file, consider converting the cleaned column to text to prevent Excel from reformatting it as a number.
- Test your method on a small sample (5–10 rows) before applying to the entire dataset.
Troubleshooting
- Formula returns #VALUE! or #NAME? Check that you entered the formula correctly and that your Excel version supports TEXTJOIN (Excel 2016 and later). For older versions, use a user-defined function or Power Query.
- Leading zeros still missing. Ensure the helper column is formatted as Text before applying the formula, or use Power Query with the column type set to Text.
- Some numbers become blank. Those cells likely contained no digits. Check the originals; they may be empty or contain only text like "N/A".
- Power Query does not load correctly. Make sure your data range has headers and no blank rows. If the query fails, check for merged cells or invalid characters.
- Numbers appear in scientific notation. This happens when Excel treats long numbers as numeric. Format the column as Text or prefix with an apostrophe.
- Cleaned numbers still have spaces. Use
SUBSTITUTEto remove specific characters, or use Power Query's Text.Replace function.
Frequently Asked Questions
Can I clean phone numbers without using formulas?
Yes. Use Power Query (Data > From Table/Range) and add a custom column with Text.Select([Phone], {"0".."9"}). This is repeatable and does not require array formulas.
Why do my cleaned numbers lose the leading zero?
Excel treats the result as a number, and numbers cannot have leading zeros. Format the column as Text before cleaning, or use Power Query and set the column type to Text.
How do I remove country codes from phone numbers?
If all numbers have the same country code, use RIGHT or MID to strip a fixed number of characters from the left. For mixed codes, use Power Query to split by delimiter or use a formula that checks the length.
Can I keep extensions while cleaning?
Yes, but you need to separate them first. Use Text to Columns or Power Query to split on "x" or "ext", clean the main number, then recombine if needed.
What if my phone numbers are stored as numbers, not text?
Convert them to text first (Format Cells > Text) or use a formula that treats them as text, such as TEXT(A2,"0"), before cleaning.
Is there a way to clean an entire column at once?
Yes. Enter the formula in the first cell of a helper column, then double-click the fill handle to copy it down. For Power Query, the transformation applies to the whole column.