+ Reply to Thread
Results 1 to 4 of 4

Getting the string that follows the last occurrence of a character

Hybrid View

  1. #1
    Registered User
    Join Date
    11-26-2013
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2013
    Posts
    21

    Question Getting the string that follows the last occurrence of a character

    Hi all,

    I'm looking for a formula that can get the text that follows the last instance of ")". For example,

    (1) Hello, (2) how are you, (3) great great
    (1) omelette omelette
    (1) food, (2) drinks, (3) water level is high, (4) To get instant replies by our experts at nominal charges To get instant replies by our experts at nominal charges
    (1) two four, (2) six, eight , (3) ten, twelve ... ten, twelve ...

    Any help will be greatly appreciated.
    Thank you so much for reading!

  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: Getting the string that follows the last occurrence of a character

    With your sample data A1:A4
    this regular formula, copied down, returns all of the text after the last ")" in the referenced cell
    B1: =TRIM(RIGHT(SUBSTITUTE(A1,")",REPT(" ",LEN(A1))),LEN(A1)))
    For your samples, these are the results in B1:B4
    great great
    omelette omelette
    To get instant replies by our experts at nominal charges To get instant replies by our experts at nominal charges
    ten, twelve ... ten, twelve ...
    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: Getting the string that follows the last occurrence of a character

    This formula should work as well. Someone else may be able to find a better method, however:

    =MID(A1,FIND("("&(LEN(A1)-LEN(SUBSTITUTE(SUBSTITUTE(A1,")",""),"(","")))/2&")",A1)+4,LEN(A1))
    This is also assuming your text starts in cell A1, but you can change the cell reference as needed.

    Hope this helps!
    Last edited by mcmahobt; 11-20-2014 at 10:00 AM.
    Spread the love, add to the Rep

    "None of us are as smart as all of us."

  4. #4
    Registered User
    Join Date
    11-26-2013
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2013
    Posts
    21

    Re: Getting the string that follows the last occurrence of a character

    Thank you for your responses! I'll use the latter.

+ 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] find the character position in a string of the last occurrence of a nominated character
    By jmac1947 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-04-2014, 11:52 PM
  2. Replies: 7
    Last Post: 08-31-2013, 12:30 PM
  3. Cutting off a string at the last occurrence of a character
    By isabelle.r in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-24-2013, 09:42 AM
  4. How to Delete Text Before First Occurrence Of Character?
    By JimMW in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-09-2012, 11:06 AM
  5. Replies: 4
    Last Post: 02-14-2006, 10:30 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