+ Reply to Thread
Results 1 to 9 of 9

Return only numbers directly after specific substring

  1. #1
    Forum Contributor
    Join Date
    03-26-2014
    Location
    Kentucky
    MS-Off Ver
    Excel 2013
    Posts
    128

    Return only numbers directly after specific substring

    I could really use some help with a formula... it needs to return the number directly following substring "RX" within a string? For example if i have the string "12354165RX15" then just show "15". Another example is "165163546RX15_G_B" then it would still need to also just show "15". I have tried a few different things with no luck.There shouldn't ever be anymore numbers in the string, other than the one immediately following the "RX". Also note that the number can range from 1-4 digits. Any help would be greatly appreciated.

  2. #2
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Return only numbers directly after specific substring

    Try this
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Regards

  3. #3
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Return only numbers directly after specific substring

    Hi
    Sorry, I don't see de range 1-4 digits.
    The array formula is
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Regards

  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: Return only numbers directly after specific substring

    Try this one

    in B1 and copy down

    =--TRIM(MID(SUBSTITUTE(SUBSTITUTE(A1,"RX","_"),"_",REPT(" ",99)),99,99))

    Data Range
    A
    B
    1
    12354165RX15
    15
    2
    165163546RX15_G_B
    15
    3
    165163546RX1525_G_B
    1525
    Last edited by AlKey; 09-10-2015 at 02:09 PM. Reason: Replaced formula with a shorter version
    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
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Return only numbers directly after specific substring

    With a UDF

    Please Login or Register  to view this content.
    Kind regards
    Leo
    Attached Files Attached Files

  6. #6
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Return only numbers directly after specific substring

    Hi Alkey
    I tested your formula and it seems to me that is not correct. Can you test again?
    I test another array formula that is too short
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Best regards

  7. #7
    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: Return only numbers directly after specific substring

    Quote Originally Posted by José Augusto View Post
    Hi Alkey
    I tested your formula and it seems to me that is not correct. Can you test again?
    I test another array formula that is too short
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Best regards
    Why would it be not correct? The results are fine

    Data Range
    A
    B
    1
    12354165RX1595
    1595
    2
    165163546RX15_G_B
    15
    3
    165163546RX1235_G_B
    1235
    4
    165163546RX1525_G_B
    1525
    5
    165163546RX19
    19

  8. #8
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Return only numbers directly after specific substring

    Hi Alkey


    I apologize, I was testing your formula with a string that did not underscore to finish the number. Eg "165163546RX15G".

    Regards.

  9. #9
    Forum Contributor
    Join Date
    03-26-2014
    Location
    Kentucky
    MS-Off Ver
    Excel 2013
    Posts
    128

    Re: Return only numbers directly after specific substring

    Thank you all greatly for the help!

+ 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] Search substring and return adjacent value
    By uberathlete in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-02-2015, 07:06 PM
  2. Match Substring to another column and return value
    By JLeague in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-24-2015, 03:34 PM
  3. Add substring to specific conditions
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-08-2015, 05:08 AM
  4. Replies: 3
    Last Post: 09-07-2014, 12:25 AM
  5. If contains specific numbers then return a sum.....
    By Kesa Anne in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-31-2013, 02:01 PM
  6. Search string for substring...return match
    By Gambinus in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-21-2012, 03:18 PM
  7. Searching a String for a Specific Substring
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 08-23-2005, 04:05 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