+ Reply to Thread
Results 1 to 5 of 5

Advanced Right

  1. #1
    Registered User
    Join Date
    06-25-2005
    Posts
    46

    Advanced Right

    Hi,

    I am trying to extract the right hand few characters (pack size) from a cell and can do most of them by finding two spaces because most of them have at least two spaces, using this:

    =TRIM(RIGHT(D2,LEN(D2)-FIND(" ",D2)))

    From "ECONOMY 32% SAUSAGE 8'S 80-57G"

    This works for most of them but some of the pack sizes are only separated by one space and there are always few before, but no fixed amount and the do not work.

    What I want to do is run the find part starting from the right hand side and finding the first space, which will always be the correct place to start extracting.

    Thanks for your help,


    Roly

  2. #2
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    assuming the description does notend in a space

    =MID(D2,1+FIND("^",SUBSTITUTE(D2," ","^",LEN(D2)-LEN(SUBSTITUTE(D2," ","")))),999)

    if ^ is a unique character, otherwise find another character that is

    regards

    Dav

  3. #3
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444
    Hi,

    To extract the last word in A1,

    =MID(SUBSTITUTE(A1," ","^",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))),FIND("^",SUBSTITUTE(A1," ","^",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+1,256)
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  4. #4
    Forum Contributor
    Join Date
    03-14-2006
    Location
    Pakistan
    Posts
    1,791

    Lightbulb

    Quote Originally Posted by roly
    Hi,

    I am trying to extract the right hand few characters (pack size) from a cell and can do most of them by finding two spaces because most of them have at least two spaces, using this:

    =TRIM(RIGHT(D2,LEN(D2)-FIND(" ",D2)))

    From "ECONOMY 32% SAUSAGE 8'S 80-57G"

    This works for most of them but some of the pack sizes are only separated by one space and there are always few before, but no fixed amount and the do not work.

    What I want to do is run the find part starting from the right hand side and finding the first space, which will always be the correct place to start extracting.

    Thanks for your help,


    Roly
    Please post some more examples of your data with the required outcome.

    "ECONOMY 32% SAUSAGE 8'S 80-57G"

    what should be the outcome in above example.

  5. #5
    Registered User
    Join Date
    06-25-2005
    Posts
    46
    Sweep that worked great - it worked for them all, not just the single space ones. Thanks a lot and you other guys!

+ 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