+ Reply to Thread
Results 1 to 6 of 6

extract last part of a text string

  1. #1
    Registered User
    Join Date
    07-18-2011
    Location
    DC, US
    MS-Off Ver
    Excel 2007
    Posts
    14

    extract last part of a text string

    In excel suppose I have a text cell which is of the following format:
    A->BBB--->CCC---->DDDD
    i want to use a formula to return the last part "DDDD"

    Thanks in advance.
    Last edited by NBVC; 09-23-2011 at 02:07 PM.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Please help with text string problem

    If it's always the last 4 characters you want then, if your string is in cell A1, in another cell put =RIGHT(A1,4)

    If you want the section after the last > that's a bit more complicated.

  3. #3
    Registered User
    Join Date
    07-18-2011
    Location
    DC, US
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Please help with text string problem

    Quote Originally Posted by Andrew-R View Post
    If it's always the last 4 characters you want then, if your string is in cell A1, in another cell put =RIGHT(A1,4)

    If you want the section after the last > that's a bit more complicated.
    Thanks for the reply
    The length is not fixed. You are right, I think I need to find the part that is after the last >.
    And the number of ">"s are not fixed either.

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Please help with text string problem

    OK, again with the data in A1 try ... =MID(A1,FIND("~",SUBSTITUTE(A1,">","~",LEN(A1)-LEN(SUBSTITUTE(A1,">",""))))+1,255)

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Please help with text string problem

    Try:

    =TRIM(LEFT(RIGHT(SUBSTITUTE(A1,">", REPT(" ",LEN(A1))),LEN(A1)),LEN(A1)))
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  6. #6
    Registered User
    Join Date
    07-18-2011
    Location
    DC, US
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Please help with text string problem

    Quote Originally Posted by NBVC View Post
    Try:

    =TRIM(LEFT(RIGHT(SUBSTITUTE(A1,">", REPT(" ",LEN(A1))),LEN(A1)),LEN(A1)))
    It works great. Thank you very much

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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