+ Reply to Thread
Results 1 to 6 of 6

Pull specific string of data from variable cell value

  1. #1
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Pull specific string of data from variable cell value

    Hello!

    I have a need for a formula based data extraction/verification method. I receive a list of values, which is not always in the correct format.

    I need to extract a 7 digit string which is alpha for the first three characters, and numeric for the last four. For example, AAA0001 to ZZZ9999

    The problem is, sometimes the number in the cell is surrounded by other characters of varying length, both letters and numbers (there will only be one occurrence of the number/format I need to extract), it could be the first 7 digits of a string, the last 7, somewhere in the middle. Sometimes it is separated by a character I can delimit by such as a "-", but when this is the case the number I need is not always in the same delimited location and ends up in in different columns on half of the rows.

    Short version is I need a formula that will find a string of three letters followed by numbers and return that value, regardless of it's position within a cell.

    Thanks in advance!

  2. #2
    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
    52,929

    Re: Pull specific string of data from variable cell value

    it sure would help if you provided a few representative samples and showed what you wanted (and how you arerived at that?
    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

  3. #3
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Pull specific string of data from variable cell value

    Thank you for the quick reply, Unfortunately I cannot unload any files from the machine I am using at the moment, however you can use the following comma separated text to easily build a sample sheet

    Please Login or Register  to view this content.
    you will see in row 4 the number is already what I need, which can happen. also row 6 contains no matching strings, and B6 is left blank as a result

    Thanks!

  4. #4
    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: Pull specific string of data from variable cell value

    I think for this you would need to use UDF (user defined function)

    1. Copy code below
    2. Press Alt and F11 on your keyboard to open VB Editor
    3. Click on Insert and select Module
    4. Paste code into Module and close VB Editor.

    and use formula:

    =GetSerialNo(A1)

    Please Login or Register  to view this content.
    A
    B
    1
    123D415-ABC4482-A1 ABC4482
    2
    DEF4567/1100TF04-1 DEF4567
    3
    GHI8765 GHI8765
    4
    01-20-10/99382AAX/HIJ9928/02 HIJ9928
    5
    AD-E4WAR-FS-R5ADF
    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

  5. #5
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Pull specific string of data from variable cell value

    AlKey,

    Thank you for this and it does appear to be working exactly as needed, however I cannot use any VBA for this particular projec.I think this could be done formulaically... If there is no possible way to achieve this with formulas I will make myself a buffer sheet with your example and do some manual copy/paste work

    Thanks again!

  6. #6
    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: Pull specific string of data from variable cell value

    Thank you 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. [SOLVED] VBA to pull data from worksheet to a new sheet based on specific text cell value
    By TalResha in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-13-2013, 02:11 AM
  2. [SOLVED] Need code to pull numeric data out of an alphanumeric string (string not constant)
    By harrydnyc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-09-2013, 04:44 PM
  3. Replies: 3
    Last Post: 01-27-2013, 07:23 PM
  4. Replies: 3
    Last Post: 04-29-2012, 03:16 AM
  5. Replies: 1
    Last Post: 10-30-2008, 07:40 PM

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