+ Reply to Thread
Results 1 to 4 of 4

Formula to extract 10 or 11 digit phone numbers from random complex test string

Hybrid View

  1. #1
    Registered User
    Join Date
    03-19-2016
    Location
    Pune
    MS-Off Ver
    2010
    Posts
    1

    Formula to extract 10 or 11 digit phone numbers from random complex test string

    Hello Experts,

    I a newbee in field of excel formula and need your help in a complex formula, where i need to extract phone numbers from a string of random text. This does not have a fix format for the string

    Example set off strings:

    Dring to data add9724516002
    add 08107936777
    8726169633 plz add. Me
    9767488106 mujhe bhi add karo dosto

    I have already tried many formulas but nothing seem to work. Formulas here dont seem to work perfectly -http://www.excelforum.com/excel-formulas-and-functions/1064845-extract-10-digit-number-only-from-text-string.html.

    Anmol Dubey

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Formula to extract 10 or 11 digit phone numbers from random complex test string

    try:
    Formula: copy to clipboard
    =INT(NPV(-0.9,IFERROR(MID(A1,1+LEN(A1)-ROW(INDIRECT("1:"&LEN(A1))),1)/10,"")))
    with Control+Shift+Enter
    it will extract ALL digits from the string.
    If there will be problem with Scientific notation try this one:
    Formula: copy to clipboard
    =LEFT(INT(NPV(-0.9,IFERROR(MID(A1,1+LEN(A1)-ROW(INDIRECT("1:"&LEN(A1))),1)/10,""))),LEN(A1))
    with CSE also.

    EDIT:
    or (just for fun ) you can try with simply UDF function:
    1. VBA code
    2.
    Formula: copy to clipboard
    =regex(A1,"\d{10,11}")
    it will extract 10 or 11 digits only (no more, no less)
    Last edited by sandy666; 03-19-2016 at 01:37 AM. Reason: regex added

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,052

    Re: Formula to extract 10 or 11 digit phone numbers from random complex test string

    Or this regular formula...
    =LOOKUP(99^99,--("0"&MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),ROW($1:$10000)))) Courtesy of:*Ron Coderre
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,944

    Re: Formula to extract 10 or 11 digit phone numbers from random complex test string

    =IFERROR("0"&MID(SUBSTITUTE(A1," ","*")&"a",MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),11)+0,MID(A1&"a",MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),10))
    try this formula, hope someone come with better formula
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Phone numbers to extract
    By mikebonyad in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-13-2014, 12:14 PM
  2. Extract 4 digit common numbers from 5 digit numbers
    By ameque in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-24-2013, 01:09 AM
  3. Macro or Function to extract phone numbers and emails from a string
    By jz789 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2013, 10:32 PM
  4. [SOLVED] Macro or Function to extract phone numbers and emails from a string
    By jz789 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-28-2013, 10:31 PM
  5. [SOLVED] macro to extract 9 digit numbers as well as alpha numberic 9 digit numbers from txt file
    By Raju Radhakrishnan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-13-2012, 10:15 AM
  6. Extract 9 digit number from string
    By Jbentley in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-16-2011, 07:02 AM
  7. [SOLVED] Extract 10 digit number from string
    By R. Choate in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 10-27-2005, 06:05 PM
  8. Extract 2, 3, 4 or 5-digit number from string
    By Jim in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-07-2005, 10:22 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1