+ Reply to Thread
Results 1 to 9 of 9

Extract text from string with forward slashes

  1. #1
    Registered User
    Join Date
    04-08-2015
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Extract text from string with forward slashes

    Hi all,

    I have following text string:

    Index/Revenue/High/5.2

    I managed to get "Index" with the formula: =LEFT(A1,FIND("/",A1,1)-1)

    and also "Revenue" with: =LEFT(MID(A1,FIND("/",A1)+1,LEN(A1)),FIND("/",(MID(A1,FIND("/",A1)+1,LEN(A1))))-1)

    Can anybody please tell me how to get "High" and "5.2"?

    Thanks a lot in advance!

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Extract text from string with forward slashes

    With
    A1: some text delimited by slashes....Index/Revenue/High/5.2

    Item 1:
    Please Login or Register  to view this content.
    Items 2, 3, and 4
    Please Login or Register  to view this content.
    Copy that formula across through E1

    The results will be:
    Please Login or Register  to view this content.
    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Extract text from string with forward slashes

    Use this & drag to the right.

    =TRIM(MID(SUBSTITUTE("/"&$A1,"/",REPT(" ",125)),125*COLUMNS($A:A),125))
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    04-08-2015
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Re: Extract text from string with forward slashes

    Thanks a lot for your answers. Both work.

    But is there a way to put it into one formula without using other columns or dragging to the right? The reason is, that I have a lot of data - is there a way to modify the formulas that I am using above?

    Thanks again,
    Edris

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Extract text from string with forward slashes

    Now you have me confused. If you want to separate them, aren't they going to be in different cells... Can you post an Excel sheet showiung your desired results?

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Extract text from string with forward slashes

    If you enter the one formula that I suggested, it will return one "word" in each cell. If you select B1-G1 and drag down, you'll do all of your data in one go.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-08-2015
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Re: Extract text from string with forward slashes

    Hi Glenn,

    thanks, I am using your formula - I think I had mixed sth up, but the substitute/rept is exactly what I needed.

    Before we close that thread, could you kindly give me as hort explanation of the formula, as it seems that there a re a lot of ways to do it, but never seen this one.

    Thanks

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Extract text from string with forward slashes

    OK... but credit where credit's due. I first saw ALKEY (another regular here) use this. In essence, it fins the delimiter - in your case a / and adds a lot of spaces (125) after it. The mid function then returns the first 125 characters (most of which are spaces) and trim removes the extra spaces; leaving the text to the left of the delimiter. As you drag it acrosss, it puts twice, three, four times the number of spaces in... which "as if by magic" separates the text at each delimitier.

    Thanks ALKEY.

    Glad to have helped! If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. It'd also be appreciated if you were to click the add Reputation button at the foot of any of the posts of those who helped you reach a solution.

  9. #9
    Registered User
    Join Date
    04-08-2015
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Re: Extract text from string with forward slashes

    Makes totally sense - thanks for the explanation!

    I will close the thread - thanks again to all for the support.

+ 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. Replies: 3
    Last Post: 04-09-2014, 02:37 PM
  2. [SOLVED] How to Extract A Number from String if Text within the String Equals XYZ
    By tyrsfury in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-15-2012, 03:30 PM
  3. Adding In Forward Slashes After text (/)
    By AV1D in forum Excel General
    Replies: 5
    Last Post: 01-19-2012, 07:59 PM
  4. Extract small string of text from larger string
    By mark_jam3s in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-23-2010, 05:36 AM
  5. [SOLVED] hyphen to forward slashes?
    By bailbust63 in forum Excel General
    Replies: 3
    Last Post: 07-25-2006, 08:00 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