Excel Extracting Phone Numbers: Using Functions to Pull Numbers from Text

When a mobile number is mixed into names, addresses, or notes, a fixed-length MID function often extracts the wrong digits. This article explains how to locate the number by the 11-digit pattern, and provides ready-to-use formulas, verification methods, and ways to handle data from PDFs.

Key Points of This Article

  • When the phone number's position is not fixed, using MID with a fixed start position will extract the wrong digits. First locate the run of 11 consecutive digits, then extract the value.
  • Mainland China mobile numbers are 11 digits and start with 1. Filtering by these two conditions can exclude most interfering numbers.
  • The number must not be directly adjacent to other digits before or after it; otherwise, a segment of a longer digit string may be mistakenly taken as a phone number.
  • For numbers containing hyphens or spaces, first use SUBSTITUTE to remove the separators, then extract.
  • Spot-check the extracted results, and use COUNTIF to check for duplicates or omissions.

Many tables cram the phone number into the same cell as other content: "Zhang San 13800138000 Chaoyang, Beijing", or "Phone: 138-0013-8000 (Note: Call back Monday)". If you use MID to cut from a fixed position, the results will shift as soon as the name lengths differ. This article is for people who need to organize customer lists, registration forms, or contact directories in bulk, and explains how to use functions to extract mobile phone numbers from mixed text.

After reading this, you will be able to find phone numbers using a single formula based on the "11 digits, starting with 1" pattern, know which cases need preprocessing first, and judge whether the results are reliable. If the phone numbers come from a PDF, the end of the article also explains how to preprocess the data.

How do I extract a phone number embedded in mixed text using a function? One-sentence answer

Find the numbers by pattern first, not by fixed position. A mobile number in mainland China is 11 digits starting with 1, so the formula only needs to find fragments like this.

Your situationRecommended PracticesCause
The phone number has a fixed prefix in front of it, such as "Phone:"Use FIND to locate the prefix, then use MID to extract the 11 digits.The formula is simple and fast, but it breaks when the prefix changes.
Names and addresses vary in length, and phone numbers do not have a fixed position.Combined formulas using LET, SEQUENCE, and FILTER in Excel 365Check every 11-digit fragment paragraph by paragraph, without relying on position.
Old version of Excel, no newer functions such as FILTERUse a helper column to check each row one by one, then filter or use Find to locate the results.Compatible in function; many steps, but easy to verify.
Numbers with dashes or spacesFirst clean with SUBSTITUTE, then extract.The separator breaks up consecutive digits, so they can't be captured.
Data comes from scanned PDFFirst perform OCR recognition, then export to ExcelThe text in the image cannot be read directly by the function.

Before You Begin: Confirm These Points

Look at the data first. Open the spreadsheet, pick twenty rows at random, and note what characters usually come right before and after the phone numbers. If "Phone:" always appears just before the number, a fixed prefix is the easy way to locate it. Only when the positions are irregular do you need to search by pattern. This step keeps you from using complicated formulas for a simple problem.

Confirm whether it is a mainland China mobile number. The formula uses the condition "11 digits, starting with 1," which applies to mainland China mobile numbers. Hong Kong, Macau, Taiwan, and overseas numbers, or landline numbers with area codes, follow different rules and require separate conditions.

Check your Excel version. The formulas use FILTER, SEQUENCE, and LET, which belong to newer versions. If the cell shows #NAME? when opened, your version does not support them, and you should use a helper-column approach instead.

Pay attention to cell formatting. If the numbers are in numeric format, a leading 1 will not be a problem; but if the original data is stored as text, character checks in formulas are more reliable. For long numbers displayed in scientific notation, change the cell format to Text before pasting the data.

Mind the separators in the source text. Dashes, spaces, and brackets often appear in the middle of numbers, such as "138 0013 8000". They break up consecutive digits, so they must be cleaned up first.

Steps to Extract Phone Numbers Using Formulas in Excel

  1. Place the original text in column A, starting from A2.
  2. In the empty cell B2, enter the cleaning formula: =SUBSTITUTE(SUBSTITUTE(A2,"-","")," ",""). This removes the hyphens and spaces, and you should confirm that the result is a continuous string of digits.
  3. If you are using a newer version of Excel, enter the following formula in C2. It adds a space at both the beginning and end to ensure the boundary check is correct, then lists all 11-digit fragments and keeps only the one that starts with 1 and has no digits before or after it: =LET(p," "&B2&" ",k,SEQUENCE(LEN(p)-12),c,MID(p,k+1,11),ok,ISERROR(--MID(p,k,1))ISERROR(--MID(p,k+12,1))ISNUMBER(--c)(LEFT(c,1)="1")ISERROR(FIND(" ",c)),IFERROR(INDEX(FILTER(c,ok),1),"Not Found"))
  4. Press Enter to confirm. C2 will display the phone number or "not found". If nothing is found, check whether B2 really contains an 11-digit number.
  5. Fill C2 down to all data rows. Note that the formula references the cleaned results in column B, so do not drag the formula in column A directly.
  6. If your spreadsheet is older and does not have the FILTER function, you can use MID in helper columns to extract each 11-character fragment, use IF to check whether the first digit is 1, and then use filtering to find the results. This method takes more steps, but you can see the intermediate values at each stage, which makes troubleshooting easier.
  7. If the number has a fixed prefix, such as "Phone: ", you can enter =MID(B2,FIND(": ",B2)+1,11) directly. This is simpler, but if the prefixes are inconsistent, use the formula above instead.
  8. Copy the result column and paste it as values (Paste Special > Values), then delete the helper columns. This prevents the file from producing errors elsewhere due to formula references.

Verify item by item after completion

After the extraction is complete, do not deliver it directly. Perform at least the following checks.

Checklist itemsHow do you see it?What should I do if I have a problem?
Are the results all 11 digits?Use the LEN function in a blank column to count the characters, then check whether they all equal 11.Lines with the wrong length: open the original text separately and check whether there are extra digits or missing digits.
Rows showing "Not found"Use the filter feature to show only these rowsCheck the original text. The number may be written incorrectly, may contain special symbols, or may not be present at all, in which case it will need to be added manually.
Did you pick up the wrong number by mistake?Spot-check twenty lines and compare them against the original.If a segment is extracted from an ID card number or an order number, it means the boundary check did not take effect. Check whether the characters immediately before and after are adjacent digits.
Is there any duplication?Count how many times each number appears using COUNTIFDuplicate phone numbers may indicate multiple records belonging to the same person, and manual review is needed to decide whether they should be merged.
Is the first place 1?Use the LEFT function to view the first characterNumbers that don't start with 1 are usually not mainland Chinese mobile numbers, so their source needs to be confirmed.

There is still a possibility that extraction results will contain errors when processing large volumes of data, especially when the notes contain other 11-digit numbers. Key data, such as numbers used for notifications or settlements, should be spot-checked item by item.

📊 Core Comparison

Three extraction approaches each have their own scope of applicability, and you can choose among them based on the patterns in the data.

Extraction approachSuitable dataMain limitations
Fixed-position extraction (MID with a fixed number)The format must be completely uniform, for example every line is "number + code", and the code always starts from the 5th digit.When names have different lengths, the alignment gets off, so this cannot be used.
Fixed-prefix positioning (FIND plus MID)Phone numbers have clear labels in front of them, for example "Mobile:" or "Phone:".The prefix spelling differences will cause it to fail.
Pattern finding (11-digit numbers with the first digit being 1)The position and prefix are both not fixed, which is the main method this article covers.The formula is quite long and requires a newer version of Excel, or you can use a helper column instead.

🎯 Which Approach Suits You?

  • If your table is small, say a few dozen rows, and the format is consistent, just use a MID formula with a fixed prefix; it is also quick to modify.
  • If you have several hundred rows of mixed text copied from web pages, chat logs, or old documents, use a formula that finds patterns, and spot-check the results.
  • If you need to hand the work over within a team and your colleagues use an older version of Excel, prefer the helper-column approach so that every step is visible.

❓ Frequently Asked Questions (FAQ)

1. If there's a hyphen in the middle of the number, can the formula still be used?

Yes, but clean it first. Before the formula, use SUBSTITUTE to remove the hyphens and spaces, then extract from the cleaned result. If you extract directly from the original text, the separators will break up the continuous digits and the formula will show "not found."

2. How do I extract phone numbers from a PDF?

If the PDF is text-based, you can export its content to Excel using the PDF editor in the OmniDoc desktop client, and then process it with the formulas above. If the PDF is a scanned document, first use OCR to recognize the text, verify that the recognition results are accurate, and then export. OCR may produce digit errors, so important numbers should be checked both before and after extraction.

3. Can only a complete number like "13800138000" be extracted?

Able to extract the complete 11-digit number. If the original text reads "+86 13800138000", the "+86" in front is not a digit and does not affect extraction; if it is written in a form like "008613800138000", extra handling is needed, because it is not the standard 11-digit form.

4. Why do we sometimes get the wrong number?

A common cause is that the source text contains other long numbers, such as ID card numbers or order numbers, and the formula's boundary check on the leading and trailing characters does not take effect. First, check whether there are spaces or punctuation before and after the number in the cell. If it is directly adjacent to other digits, you need to manually verify that record.

5. Are the extracted numbers text or numbers?

The official return is in text form. If sorting or counting is needed later, text sorting is usually fine, but if numerical operations are required, the numbers themselves don't need to be computed. To avoid losing leading zeros or format changes, it is recommended to keep them in text format.

📝 Summary

Extracting phone numbers from mixed text depends on the rule "11 digits, starting with 1, not directly adjacent to other digits," rather than on fixed positions. First clean up the separators, then extract, and finally spot-check a sample. With large data volumes or text from PDFs, taking one extra step to verify saves rework later.

Open OmniDoc and export the PDF content as an editable file

Updated 2026-11-29