Excel Formulas to Clean and Format Phone Numbers with Country Codes

📅 Mar 27, 2026 📝 Sarah Miller

Managing inconsistent phone data with messy country codes often stalls outbound communication campaigns and distorts CRM records. While manual overrides or basic Find-and-Replace operations offer temporary fixes, they fail to scale across large corporate datasets.

Utilizing a dynamic Excel formula grants you instantly standardized, dial-ready databases, saving hours of manual labor. To work effectively, this approach stipulates that your raw numbers share a baseline prefix structure. By nesting robust functions like SUBSTITUTE, MID, and LEN, you can systematically strip formatting debris. Below, we outline the exact formulas to automate your database cleansing.

Excel Formulas to Clean and Format Phone Numbers with Country Codes

Excel Formula to Clean Phone Numbers with Country Codes

Managing contact databases is a common task for marketers, sales operations teams, and data analysts. However, phone numbers are notoriously messy. When exporting data from CRMs, web forms, or legacy systems, you often end up with a chaotic mix of formats: some numbers have country codes, some have leading zeros, others contain spaces, hyphens, parentheses, or even plus signs.

To run successful SMS campaigns, automate sales dialers, or integrate systems seamlessly, you must standardize these phone numbers into a clean, uniform format. The global standard for this is E.164 format, which formats numbers as +[Country Code][Subscriber Number] without any spaces, dashes, or special characters (e.g., +15551234567).

In this guide, we will explore several Excel formulas to clean phone numbers, strip unwanted characters, and dynamically add country codes. We will cover both classic formulas compatible with older Excel versions and modern dynamic array formulas for Microsoft 365.

The Goal: Achieving E.164 Standardization

Before writing our formulas, let us define what "clean" means. Our objective is to take various inconsistent inputs and convert them to a standardized output:

Raw Input Target Output (E.164 US/Canada) Target Output (E.164 UK)
+1 (555) 019-2834 +15550192834 -
555.019.2834 +15550192834 -
07911 123456 (Local UK) - +447911123456
00 44 7911 123456 - +447911123456

Step 1: Removing Special Characters, Spaces, and Symbols

The first step in any cleaning pipeline is removing non-numeric clutter. This includes hyphens, spaces, periods, and parentheses.

The Legacy Approach: Nested SUBSTITUTE Formulas

If you are using older versions of Excel (Excel 2019 or earlier), the most reliable way to strip characters is by nesting multiple SUBSTITUTE functions. This formula checks for spaces, dashes, parentheses, and periods, replacing them with empty strings (""):

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2, " ", ""), "-", ""), "(", ""), ")", ""), ".", "")

How it works: Excel evaluates this from the inside out. It first removes spaces, passes that result to the next SUBSTITUTE to remove dashes, and continues until all specified characters are stripped away.

The Modern Approach: Excel 365 REDUCE and LAMBDA

For Microsoft 365 users, nesting multiple SUBSTITUTE functions is inefficient and hard to read. Instead, you can use the REDUCE function combined with LAMBDA to loop through an array of unwanted characters and strip them out in one elegant stroke:

=REDUCE(A2, {" ","-","(",")",".","+"}, LAMBDA(text, char, SUBSTITUTE(text, char, "")))

How it works:

  • REDUCE takes the initial value in cell A2.
  • It loops through each item in the array constant {" ","-","(",")",".","+"}.
  • For each item, the LAMBDA function executes SUBSTITUTE, progressively cleaning the string.


Step 2: Formatting and Adding the Country Code

Once you have a clean string of digits, the next challenge is standardizing the country code. Depending on your data, you might face three scenarios: the country code is already present, it is represented as 00 instead of +, or it is completely missing.

Scenario A: Country Code is Missing (Adding a Default Country Code)

If your leads are mostly domestic (for example, within North America) and lack the country code 1, you need to add it. Let us assume a standard North American Numbering Plan (NANP) length of 10 digits.

To add +1 to any 10-digit number while keeping existing international codes untouched, use this logical statement:

=LET(
    CleanDigits, REDUCE(A2, {" ","-","(",")",".","+"}, LAMBDA(t,c, SUBSTITUTE(t,c,""))),
    IF(LEN(CleanDigits)=10, "+1" & CleanDigits, "+" & CleanDigits)
)

Explanation: This formula uses LET to declare a variable CleanDigits. It then checks the length of the cleaned string. If it is exactly 10 digits, it prepends +1. Otherwise, it assumes an international country code is already present and simply adds the prefix +.

Scenario B: Standardizing European/International Numbers (e.g., UK +44)

European and international numbers present a unique challenge: domestic numbers often begin with a leading zero (e.g., 07911 123456 in the UK), which must be dropped when the country code is added (yielding +447911123456). Additionally, some international users type 0044 instead of +44.

Here is how you handle these variables dynamically for a specific country code (using the UK +44 as an example):

=LET(
    RawText, A2,
    CleanDigits, REDUCE(RawText, {" ","-","(",")",".","+"}, LAMBDA(t,c, SUBSTITUTE(t,c,""))),
    IsZeroStart, LEFT(CleanDigits, 1)="0",
    IsDoubleZeroStart, LEFT(CleanDigits, 2)="00",
    
    IFS(
        IsDoubleZeroStart, "+" & MID(CleanDigits, 3, LEN(CleanDigits)),
        IsZeroStart, "+44" & MID(CleanDigits, 2, LEN(CleanDigits)),
        TRUE, "+" & CleanDigits
    )
)

How this logic works:

  1. CleanDigits: Strips all non-numeric characters.
  2. IsDoubleZeroStart: Checks if the number starts with 00 (e.g., 0044...). If true, it strips the 00 and prepends a +.
  3. IsZeroStart: Checks if the number starts with a single domestic zero (e.g., 07911...). If true, it strips that leading zero using MID(CleanDigits, 2, LEN(CleanDigits)) and prepends the international code +44.
  4. Default (TRUE): If neither condition is met, it assumes the number is already complete and prepends the + symbol.

Step 3: The All-in-One Master Formula

If you have a global list of contacts, you might want a formula that checks the current state of the number, cleans it up, and formats it based on its starting digits. Here is an all-in-one formula that cleans the data, replaces leading international double zeros (00) with a plus symbol, ensures the presence of a plus symbol, and flags numbers that are too short to be valid:

=LET(
    RawInput, A2,
    Clean, REDUCE(RawInput, {" ","-","(",")",".","[","]"}, LAMBDA(val,char, SUBSTITUTE(val,char,""))),
    Standardized, IF(LEFT(Clean, 2)="00", "+" & MID(Clean, 3, LEN(Clean)), IF(LEFT(Clean, 1)="+", Clean, "+" & Clean)),
    DigitCount, LEN(REDUCE(Standardized, {"+"}, LAMBDA(v,c, SUBSTITUTE(v,c,"")))),
    
    IF(DigitCount < 7, "Review Required (Too Short)", Standardized)
)

This master formula is perfect for data validation prior to importing lists into marketing automation software like HubSpot, Salesforce, or Marketo. It not only formats the numbers cleanly but alerts you with "Review Required (Too Short)" if the resulting phone number contains fewer than 7 digits, preventing you from sending useless data to your external databases.


Alternative: Cleaning Phone Numbers Using Power Query

If you have tens of thousands of rows of data, running complex formulas in Excel can sometimes slow down your workbook. In such cases, Power Query is a highly efficient alternative. Here is how you can achieve the same result in Power Query:

  1. Select your data range, navigate to the Data tab, and click From Table/Range.
  2. In the Power Query Editor, select the phone number column.
  3. Go to Transform > Replace Values. Replace hyphens, spaces, and brackets with nothing (leave the "Replace With" field blank).
  4. Add a custom column to handle your country code logic using an M-code conditional statement, such as:
    if Text.StartsWith([Phone], "0") then "+44" & Text.Middle([Phone], 1) else "+" & [Phone]
  5. Click Close & Load to return your beautifully cleaned data back to Excel.

Conclusion

Standardizing phone numbers does not require manual, tedious search-and-replace processes. By leveraging Excel's nested functions, modern LET and REDUCE lambdas, or Power Query, you can easily automate the extraction, cleaning, and formatting of phone numbers with country codes. Implementing these formulas in your workflow guarantees clean data entry, reduces communication failures, and improves lead routing efficiency.

Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.