+ Reply to Thread
Results 1 to 3 of 3

Find last occurance of character in text string

  1. #1
    JDay01
    Guest

    Find last occurance of character in text string

    I am working with a spreadsheet that contains product descriptions. The
    descriptions have varying lengths, but all have a "suffix" code of some type
    at the end of the description that I would like to eliminate. Here is an
    example of the data I'm working with:

    10 OZ GREEN BEANS Rfg
    12 OZ CHILI WITH MEAT AND BEANS Grocery

    In this example, I need to eliminate the " Rfg" in line 1, and the "
    Grocery" text in line 2. My hunch is that I need to use a combination of
    "FIND" and "LEFT" to basically find the last occurance of "space", then bring
    back the leftmost "n" characters based on the position of that last "space".
    Can someone help??

  2. #2
    Bob Umlas
    Guest

    Re: Find last occurance of character in text string

    =LEFT(A1,FIND(CHAR(171),SUBSTITUTE(A1,"
    ",CHAR(171),LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))-1)
    and fill down.
    Bob Umlas
    Excel MVP

    "JDay01" <[email protected]> wrote in message
    news:[email protected]...
    > I am working with a spreadsheet that contains product descriptions. The
    > descriptions have varying lengths, but all have a "suffix" code of some

    type
    > at the end of the description that I would like to eliminate. Here is an
    > example of the data I'm working with:
    >
    > 10 OZ GREEN BEANS Rfg
    > 12 OZ CHILI WITH MEAT AND BEANS Grocery
    >
    > In this example, I need to eliminate the " Rfg" in line 1, and the "
    > Grocery" text in line 2. My hunch is that I need to use a combination of
    > "FIND" and "LEFT" to basically find the last occurance of "space", then

    bring
    > back the leftmost "n" characters based on the position of that last

    "space".
    > Can someone help??




  3. #3
    Ron Coderre
    Guest

    RE: Find last occurance of character in text string

    Try something like this:

    With text in A1
    B1: =LEFT(A1,LOOKUP(LEN(A1),FIND("
    ",A1,ROW(INDEX($A:$A,1,1):INDEX($A:$A,LEN(A1),1))))-1)

    Does that help?

    ***********
    Regards,
    Ron

    XL2002, WinXP-Pro


    "JDay01" wrote:

    > I am working with a spreadsheet that contains product descriptions. The
    > descriptions have varying lengths, but all have a "suffix" code of some type
    > at the end of the description that I would like to eliminate. Here is an
    > example of the data I'm working with:
    >
    > 10 OZ GREEN BEANS Rfg
    > 12 OZ CHILI WITH MEAT AND BEANS Grocery
    >
    > In this example, I need to eliminate the " Rfg" in line 1, and the "
    > Grocery" text in line 2. My hunch is that I need to use a combination of
    > "FIND" and "LEFT" to basically find the last occurance of "space", then bring
    > back the leftmost "n" characters based on the position of that last "space".
    > Can someone help??


+ 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