Extracting Specific Phone Numbers from Concatenated Data in Excel
Extracting Specific Phone Numbers from Concatenated Data in Excel
Author: Ada Codewell – AI Specialist & Software Engineer at Gray Technical
Published on: [Date]
The Challenge of Extracting Specific Data from Concatenated Cells in Excel
Many users face the problem of extracting specific information, like phone numbers, when multiple entries are concatenated into a single cell. This is common with reports that output various contact details or other data points all together.
The Root Cause: Why It Happens?
This issue arises because many reporting tools and systems consolidate related information for convenience but don’t provide easy ways to disaggregate it later in Excel. Users often end up with a single cell containing multiple phone numbers, addresses, or other data points separated by line breaks.
Step-by-Step Solution
Let’s break down the process of extracting specific phone numbers from concatenated cells using formulas and tools like CelTools, which can automate this task efficiently for frequent users.
Example 1: Extracting Mobile Numbers Using Formulas

=TRIM(MID(SUBSTITUTE(A1, CHAR(10), REPT(" ", LEN(A1))), (COLUMN(A$1)-1)*LEN(A1)+1, LEN(A1)))
This formula works by substituting line breaks with spaces and then using MID to extract each segment. However, it can get complex for larger datasets.
Example 2: Using Text Functions in Excel
=TRIM(MID(SUBSTITUTE(A1, CHAR(10), REPT(" ", LEN(A1))), (ROW(INDIRECT("1:" & COUNTA(FILTERXML("" & SUBSTITUTE(A1,CHAR(10),"") & "","."))))) - 1) * LEN(A1) + 1, LEN(A1)))
The above formula uses FILTERXML to split the text by line breaks and then extracts each segment. This approach is more dynamic but can still be cumbersome for large datasets.
Example 3: Using CelTools for Automation

While you can do this manually, CelTools automates the entire process of extracting and cleaning data from concatenated cells. This tool offers over 70 extra features for auditing, formulas, and automation.
Advanced Variation: Extracting Specific Phone Types Using Regular Expressions (VBA)
Function ExtractPhoneNumbers(rng As Range) As String
Dim cell As Range
Dim phoneNumber As String
Dim regex As Object
Set regex = CreateObject("VBScript.RegExp")
regex.Pattern = "\d{3}-\d{3}-\d{4}"
For Each cell In rng
If Not IsEmpty(cell.Value) Then
Set matches = regex.Execute(cell.Value)
For Each match In matches
phoneNumber = phoneNumber & match.value & CHAR(10)
Next match
End If
Next cell
ExtractPhoneNumbers = Trim(phoneNumber)
End Function
This VBA function uses regular expressions to extract all phone numbers matching the pattern from a range of cells. It’s particularly useful for more complex data extraction tasks.
Common Mistakes and Misconceptions
- Ignoring Line Breaks: Many users forget that line breaks are characters too, leading to incorrect extractions.
- Overlooking Hidden Characters: Non-printing characters can interfere with text functions and formulas. Tools like CelTools handle these automatically.
A Technical Summary: Combining Manual Techniques with Specialized Tools
The combination of manual Excel techniques, such as using advanced text functions and VBA macros, along with specialized tools like CelTools, provides a robust solution for extracting specific data from concatenated cells. While formulas offer flexibility, automation tools save time and reduce errors.
Written By: Ada Codewell – AI Specialist & Software Engineer at Gray Technical






















