+ Reply to Thread
Results 1 to 21 of 21

Need help on a formula to extract specific content between different characters

  1. #1
    Registered User
    Join Date
    06-14-2017
    Location
    Bangalore
    MS-Off Ver
    Office 2013
    Posts
    8

    Need help on a formula to extract specific content between different characters

    Hi,

    In the following example, I wish to extract all the content from the last "/" and upto the "_".

    product/r3.8/mr1.0/module/epic/1234_userstoryname.

    So here i need to extract only 1234. (That is the value from the last "/" till the "_")

    Please note that there could be any number of "/" in text. I need to extract only from the last "/" till the first "_"

    Please help

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Need help on a formula to extract specific content between different characters

    removed by me
    i didn't check massive attack of "/"
    Last edited by sandy666; 06-14-2017 at 02:51 AM.

  3. #3
    Registered User
    Join Date
    06-14-2017
    Location
    Bangalore
    MS-Off Ver
    Office 2013
    Posts
    8

    Re: Need help on a formula to extract specific content between different characters

    Thanks for your quick response. Your formula returns value from the first "/" up until the first "_". I need to extract the text from the last "/" up until the first "_"

  4. #4
    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,938

    Re: Need help on a formula to extract specific content between different characters

    Hi, welcome to the forum :0

    This is really long-winded, Im sure someone will give you a better method. With your string in A1...
    =LEFT(MID(A1,FIND("@",SUBSTITUTE(A1,"/","@",(LEN(A1)-LEN(SUBSTITUTE(A1,"/","")))))+1,99),FIND("_",MID(A1,FIND("@",SUBSTITUTE(A1,"/","@",(LEN(A1)-LEN(SUBSTITUTE(A1,"/","")))))+1,99))-1)
    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

  5. #5
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Need help on a formula to extract specific content between different characters

    correction
    =IFERROR(MID(SUBSTITUTE(A1,"/","#",5),FIND("#",SUBSTITUTE(A1,"/","#",5))+1,FIND("_",A1,FIND("#",SUBSTITUTE(A1,"/","#",5))+1)-FIND("#",SUBSTITUTE(A1,"/","#",5))-1),"Check characters")
    but i see Ford did it

  6. #6
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Need help on a formula to extract specific content between different characters

    Or Try some shorter

    B1
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  7. #7
    Registered User
    Join Date
    06-14-2017
    Location
    Bangalore
    MS-Off Ver
    Office 2013
    Posts
    8

    Re: Need help on a formula to extract specific content between different characters

    Thanks a lot Ford and Sandy. Both the formulas work splendidly. Exactly how I wanted. You guys are truly stars

  8. #8
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Need help on a formula to extract specific content between different characters

    Check it with more examples because my formula works only if there is 5 "/"s
    If that takes care of your original question, please click Add Reputation then select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  9. #9
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Need help on a formula to extract specific content between different characters

    Good to hear Rajeesh that both formula works great, I have provided shorter version.

    Mr. Ford & Sandy , Numbers are retrieving in text format still....

  10. #10
    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,938

    Re: Need help on a formula to extract specific content between different characters

    Happy to help and thanks for the feedback

  11. #11
    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,938

    Re: Need help on a formula to extract specific content between different characters

    Quote Originally Posted by shukla.ankur281190 View Post
    Good to hear Rajeesh that both formula works great, I have provided shorter version.

    Mr. Ford & Sandy , Numbers are retrieving in text format still....
    If OP needs them to be real numbers, just add -- at the start...
    =--LEFT(MID(A1,FIND("@",SUBSTITUTE(A1,"/","@",(LEN(A1)-LEN(SUBSTITUTE(A1,"/","")))))+1,99),FIND("_",MID(A1,FIND("@",SUBSTITUTE(A1,"/","@",(LEN(A1)-LEN(SUBSTITUTE(A1,"/","")))))+1,99))-1)

  12. #12
    Registered User
    Join Date
    06-14-2017
    Location
    Bangalore
    MS-Off Ver
    Office 2013
    Posts
    8

    Re: Need help on a formula to extract specific content between different characters

    That's right Sandy. With one of the samples I have it has retrieved the value from the fifth "/" and not from the last "/". Ford's formula seems to work for the samples I have tried.

  13. #13
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Need help on a formula to extract specific content between different characters

    Quote Originally Posted by shukla.ankur281190 View Post
    Mr. Ford & Sandy , Numbers are retrieving in text format still....
    OP said:
    I wish to extract all the content...
    but nothing about format.


    enough add in front of formula double unary "--" and it will be as number
    Last edited by sandy666; 06-14-2017 at 03:22 AM.

  14. #14
    Registered User
    Join Date
    06-14-2017
    Location
    Bangalore
    MS-Off Ver
    Office 2013
    Posts
    8

    Re: Need help on a formula to extract specific content between different characters

    Thanks a lot Ankur. The shorter formula you gave worked for the example I have given. But it threw up a Value error for other samples I have.

    Ex) Product / R3.8 / MR1.0 / CAR/ 4.5.2.17_Create Booking From Cart / ABCD34-44645_Booking

    The above example, threw a value error.

  15. #15
    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,938

    Re: Need help on a formula to extract specific content between different characters

    I should have asked if you had more than 1 _

  16. #16
    Registered User
    Join Date
    06-14-2017
    Location
    Bangalore
    MS-Off Ver
    Office 2013
    Posts
    8

    Re: Need help on a formula to extract specific content between different characters

    Hi Ankur,

    I don't want it as a number as it would be a mix of alphabets and numbers. Sorry that I missed to mention that in the example I had given initially.

  17. #17
    Registered User
    Join Date
    06-14-2017
    Location
    Bangalore
    MS-Off Ver
    Office 2013
    Posts
    8

    Re: Need help on a formula to extract specific content between different characters

    There could be more than 1_ Ford. But all I want is the value from the last "/" to the first "_"

  18. #18
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Need help on a formula to extract specific content between different characters

    removed by JT

  19. #19
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Need help on a formula to extract specific content between different characters

    More shortest try

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

  20. #20
    Registered User
    Join Date
    06-14-2017
    Location
    Bangalore
    MS-Off Ver
    Office 2013
    Posts
    8

    Re: Need help on a formula to extract specific content between different characters

    That works Ankur. Thank you..

  21. #21
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Need help on a formula to extract specific content between different characters

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

    Please add reputation by clicking star icon left corner on solution post.

+ 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. VBA Characters() Function Fails when the Cell Content Exceeds 261 Characters
    By :) Sixthsense :) in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 03-07-2016, 06:37 AM
  2. [SOLVED] Left Formula which removes unnecessary characters and will display content if only one
    By arodgers in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-10-2013, 09:14 PM
  3. [SOLVED] formula if cell content doen not equal certain amount of characters
    By Marijke in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-25-2013, 11:19 AM
  4. [SOLVED] How to extract specific numbers after and before certain characters.
    By addytiger in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2012, 07:20 PM
  5. Replies: 3
    Last Post: 04-05-2012, 04:58 PM
  6. Formula to Extract Data with Specific Characters
    By dakkota in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-13-2011, 06:36 PM
  7. Replies: 1
    Last Post: 08-03-2006, 07:55 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