+ Reply to Thread
Results 1 to 6 of 6

Extracting numbers out of a string with alpha/number characters that are different lengths

  1. #1
    Registered User
    Join Date
    02-02-2017
    Location
    Houston
    MS-Off Ver
    2010 and 2013
    Posts
    28

    Question Extracting numbers out of a string with alpha/number characters that are different lengths

    I have a data set that has 3 types of data strings that are 10, 11, and 12 character lengths. I am needing to extract the 5th character (which is a number) followed by the following 3 or 4 numbers.
    I can extract them from the 10 and 12 character lengths, no problem due to the numbers begin at the same position and end at the same position.

    The problem is with the string that is 11 characters long.

    The numbers start (from the left) at the 5th position, but some are 3 digits and some are 4 digits.
    If you try from the right, the numbers will start from a different position due to a 1 and 2 digit number on the end. That number is not important for this issue.

    Here are examples of the data:

    NCAW1007AC8
    NCAL390AC17

    The string of numbers I am needing are:
    1007
    390

    ~frustrated with 'strings'
    thanks!

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Extracting numbers out of a string with alpha/number characters that are different len

    Will the number string ever start with leading zeros?

    NCAW0007AC8
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    02-02-2017
    Location
    Houston
    MS-Off Ver
    2010 and 2013
    Posts
    28

    Re: Extracting numbers out of a string with alpha/number characters that are different len

    no, it will always be a whole number of 1 or higher

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Extracting numbers out of a string with alpha/number characters that are different len

    Maybe this...

    Data Range
    A
    B
    1
    NCAW1007AC8
    1007
    2
    NCAL390AC17
    390
    3
    ------
    ------


    This formula entered in B1 and copied down:

    =LOOKUP(10000,--MID(A1,5,{1,2,3,4,5}))

  5. #5
    Registered User
    Join Date
    02-02-2017
    Location
    Houston
    MS-Off Ver
    2010 and 2013
    Posts
    28

    Re: Extracting numbers out of a string with alpha/number characters that are different len

    You rock!

    Thank you! Thank you!

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Extracting numbers out of a string with alpha/number characters that are different len

    You're welcome. Thanks for the feedback!

+ 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. Separating alpha and numeric characters, no delimiter, varying lengths
    By Trevor K in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-21-2016, 01:46 AM
  2. [SOLVED] Separating alpha and numeric characters, no delimiter, varying lengths
    By Trevor K in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-21-2015, 09:40 PM
  3. Extracting Number from Dates to generate a string of numbers...
    By Adam_S in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-23-2014, 04:48 AM
  4. [SOLVED] Search column for location of characters/numbers in cells with different digit lengths
    By nbhowe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-08-2013, 05:38 PM
  5. Extracting a number (part of a series of numbers) from a text string
    By dannyjoer in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-09-2012, 10:17 AM
  6. Replies: 6
    Last Post: 05-21-2012, 04:07 PM
  7. Extracting numbers from a combined text & number string
    By astrikor in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-25-2007, 08:45 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