+ Reply to Thread
Results 1 to 7 of 7

Extract a numerical value after a text.

  1. #1
    Registered User
    Join Date
    10-19-2011
    Location
    Barkhamsted, CT
    MS-Off Ver
    Excel 2013
    Posts
    22

    Exclamation Extract a numerical value after a text.

    Good afternoon all,
    I tried to reply to a previous posr but did not see my reply, so I started a new one. Sorry if this is problem. Now my problem. I have the following text:
    Padstack: 65R45D Type: through Inner pads: Optional
    Padstack: 75S45D Type: through Inner pads: Optional
    Padstack: 115R45D Type: through Inner pads: Optional.
    I want to extract the number after the space following the ":". So the first would return 65, the second 75, and the third 115. Can this be done with a formula and if so could someone please help. I have been searching for an answer for 5 hours and had some luck with the following which I found, =IFERROR(LOOKUP(1E+99,LEFT(MID(A5,LOOKUP(1E+99,SEARCH(ROW($1:$9999)&"_",A5)),9),ROW($1:$9))+0),"WRONG"), but in the 1st and 2nd example there can be a different letter between the numbers it will not work. This is why I would like to use the space, as it does not change.
    Last edited by Ken64; 05-24-2013 at 01:59 PM. Reason: solved

  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,926

    Re: Extract a numerical value after a text.

    =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

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Extract a numerical value after a text.

    That is an awesome equation. Hats off to Ron.

    I would have expected that it had to be entered as an array. I am impressed. layers upon layers.
    Last edited by ChemistB; 05-24-2013 at 02:09 PM.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    10-19-2011
    Location
    Barkhamsted, CT
    MS-Off Ver
    Excel 2013
    Posts
    22

    Re: Extract a numerical value after a text.

    Thank you very much. I don't know how you guys do this stuff. I can't wrap my head around it.

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Extract a numerical value after a text.

    Quote Originally Posted by ChemistB View Post
    That is an awesome equation. Hats off to Ron.
    +1 to this
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  6. #6
    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,926

    Re: Extract a numerical value after a text.

    Quote Originally Posted by Ken64 View Post
    Thank you very much. I don't know how you guys do this stuff. I can't wrap my head around it.
    With that formula, nor do I...I just know it works, and I know is a genius

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Extract a numerical value after a text.

    Here's what's happening;
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    This is searching the string for the first occurance numbers 0 through 9 (0123456789 is appended to the end so there's always a result so no errors are generated) and returns their positions
    and then MIN narrows that down to the very first position (which in this example is 11)

    Replacing 11 for that portion of the equation
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    generates from A1 starting at position 11 progressively strings of more characters. (6, 65, 65R, 65R4,65R45, 65R45D ....)
    When the "LOOKUP(99^99" cannot find a matching number in that progression (because 99^99 is so large) it returns the last true number it finds which (in this case) is 65.
    Last edited by ChemistB; 05-24-2013 at 02:32 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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