+ Reply to Thread
Results 1 to 11 of 11

Extract numbers from a string of alphanumeric text

  1. #1
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Extract numbers from a string of alphanumeric text

    To All Excel MVP's i need your help.
    Can anyone help me with a formula to extract numbers (account number) from a string of text that contains alphanumeric. the account number starts with 249,250,251 and TLC. Length for the 249,250 and 251 is 9; And for the TLC is 11. Any help is greatly appreciated. Thank you

    Example. Assuming data is located in A1.

    SERVICE REF: RELATED REF: ID: INS BK:XXXXXXX SER ID:PCRM SND BK: ID: 5ERANUA00000VBHJK303 249968059 91361 ID:001235737204 : ID: TLC29676085 BVDFGR 20140703-00004704 VAL D D ORIG 250360150 GTHYKKK BNNNG 566840000078955* CORRECT BK 45366363 PCRM DIGGGI SERVICE 251253955 BKSSSDR 56289

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Extract numbers from a string of alphanumeric text

    Hi,
    Are there always 4 account numbers per string?
    Are they always in exactly the same position?
    Is the result to be a single cell conatining all 4 numbers or four separate cells?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Extract numbers from a string of alphanumeric text

    Richard.
    For the most part its only 1 account number per string, but sometimes we have 2 or more.
    Should be okay to have the result in a single cell.
    Thanks for your reply.

  4. #4
    Valued Forum Contributor TheCman81's Avatar
    Join Date
    11-06-2012
    Location
    Edinburgh, UK
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013
    Posts
    346

    Re: Extract numbers from a string of alphanumeric text

    If you dont mind having them in the same cell you can use this

    =IFERROR(MID(A1,FIND(" 249",A1)+1,9),"")&" "&IFERROR(MID(A1,FIND(" 250",A1)+1,9),"")&" "&IFERROR(MID(A1,FIND(" 251",A1)+1,9),"")&" "&IFERROR(MID(A1,FIND(" TLC",A1)+1,11),"")
    Excel Guru in the making

    <----------If the question has been answered to your satisfication please click the Add Repuation star to the left

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Extract numbers from a string of alphanumeric text

    Hi,

    YOu didn't say whether they were always in the same position.
    I should also have asked if the leading 3 characters are unique or could they also appear in any of the other strings of non account number numbers?

  6. #6
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Extract numbers from a string of alphanumeric text

    The leading 3 characters (249,250,251 and TCL) are always in the same position. and they do not appear in the others strings that are not account number.

  7. #7
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Extract numbers from a string of alphanumeric text

    Quote Originally Posted by TheCman81 View Post
    If you dont mind having them in the same cell you can use this

    =IFERROR(MID(A1,FIND(" 249",A1)+1,9),"")&" "&IFERROR(MID(A1,FIND(" 250",A1)+1,9),"")&" "&IFERROR(MID(A1,FIND(" 251",A1)+1,9),"")&" "&IFERROR(MID(A1,FIND(" TLC",A1)+1,11),"")
    I entered the formula in cell A2 to get the result but its only showing blank.

  8. #8
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extract numbers from a string of alphanumeric text

    Please see attached file.
    Attached Files Attached Files
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  9. #9
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Extract numbers from a string of alphanumeric text

    Hi,

    Given post #6 then in B1 enter
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Copy to D1 & E1 changing 91 to 178 & 259 respectively
    In C1
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Extract numbers from a string of alphanumeric text

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    Given post #6 then in B1 enter
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Copy to D1 & E1 changing 91 to 178 & 259 respectively
    In C1
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Thank you.

  11. #11
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Extract numbers from a string of alphanumeric text

    Last edited by 6StringJazzer; 07-09-2014 at 09:34 PM. Reason: Removed unnecessary quote

+ 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] EXtract ALphanumeric from text string
    By Ellice16 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-30-2013, 03:34 AM
  2. Replies: 4
    Last Post: 08-05-2013, 07:27 AM
  3. extract numbers from alphanumeric text string if 1st tier not available
    By Ellice16 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-25-2013, 01:52 AM
  4. [SOLVED] VBA expression to extract the text from the beginning of an alphanumeric string
    By webfeet2 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-01-2012, 12:41 AM

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