+ Reply to Thread
Results 1 to 4 of 4

Substrings in Excel?

  1. #1
    Registered User
    Join Date
    11-04-2004
    Posts
    14

    Substrings in Excel?

    I have a spreadsheet with Comments field in one of the cells. Cell includes varying length comments, my goals is to read the last comment from this cell.

    So, really I am looking for a way to match anything after the last period "." in this cell and display it in the formated report via Vlookup. I experimented with Left and right fuctions, however, no luck.

    Can someone please help. So, for instance the string can be something like:

    Hello. This is a test. Test number one.

    I would like to grab the last comment.

    Similary, string can be something like.

    Hello. This is a test. Test number one comes after number two. You must read test number one.

    Regards,
    John

  2. #2
    Niek Otten
    Guest

    Re: Substrings in Excel?

    =RIGHT(A1,LEN(A1)-FIND("~",SUBSTITUTE(A1,".","~",LEN(A1)-LEN(SUBSTITUTE(A1,".",))-1)))

    --
    Kind regards,

    Niek Otten

    "mzafar" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I have a spreadsheet with Comments field in one of the cells. Cell
    > includes varying length comments, my goals is to read the last comment
    > from this cell.
    >
    > So, really I am looking for a way to match anything after the last
    > period "." in this cell and display it in the formated report via
    > Vlookup. I experimented with Left and right fuctions, however, no
    > luck.
    >
    > Can someone please help. So, for instance the string can be something
    > like:
    >
    > Hello. This is a test. Test number one.
    >
    > I would like to grab the last comment.
    >
    > Similary, string can be something like.
    >
    > Hello. This is a test. Test number one comes after number two. You
    > must read test number one.
    >
    > Regards,
    > John
    >
    >
    > --
    > mzafar
    > ------------------------------------------------------------------------
    > mzafar's Profile:
    > http://www.excelforum.com/member.php...o&userid=16096
    > View this thread: http://www.excelforum.com/showthread...hreadid=517319
    >




  3. #3
    Dave Peterson
    Guest

    Re: Substrings in Excel?

    How about this:

    =TRIM(MID(A1,FIND("^",SUBSTITUTE(A1,".","^",LEN(A1)
    -LEN(SUBSTITUTE(LEFT(A1,LEN(A1)-1),".",""))
    -(RIGHT(A1,1)=".")))+1,LEN(A1)))

    (all one cell)

    mzafar wrote:
    >
    > I have a spreadsheet with Comments field in one of the cells. Cell
    > includes varying length comments, my goals is to read the last comment
    > from this cell.
    >
    > So, really I am looking for a way to match anything after the last
    > period "." in this cell and display it in the formated report via
    > Vlookup. I experimented with Left and right fuctions, however, no
    > luck.
    >
    > Can someone please help. So, for instance the string can be something
    > like:
    >
    > Hello. This is a test. Test number one.
    >
    > I would like to grab the last comment.
    >
    > Similary, string can be something like.
    >
    > Hello. This is a test. Test number one comes after number two. You
    > must read test number one.
    >
    > Regards,
    > John
    >
    > --
    > mzafar
    > ------------------------------------------------------------------------
    > mzafar's Profile: http://www.excelforum.com/member.php...o&userid=16096
    > View this thread: http://www.excelforum.com/showthread...hreadid=517319


    --

    Dave Peterson

  4. #4
    Registered User
    Join Date
    11-04-2004
    Posts
    14

    Thanks

    Thanks Dave/Niek, both solutions work great!

    Regards,
    John

+ 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