+ Reply to Thread
Results 1 to 7 of 7

find last "/" character in a cell

  1. #1
    Registered User
    Join Date
    07-28-2004
    Posts
    8

    find last "/" character in a cell

    I need to extract the rightmost part of a cell, from the last "/" character in the cell. Problem is, there may be several /s in a cell and I need to identify the last one of them.

    Thanks for your help.
    Last edited by Basz; 06-16-2009 at 10:07 AM.

  2. #2
    Forum Contributor starryknight64's Avatar
    Join Date
    09-27-2006
    Location
    Missouri
    MS-Off Ver
    2003 (Work) & 2007 (Home)
    Posts
    193

    Re: find last "/" character in a cell

    Unfortunately, if you don't have Office 2007, there's no default Excel functions (that I know of) that can do this.

    However, it's fairly straightforward to make one.

    1. Hit ALT + F11
    2. Right-click on Sheet1. Goto Insert-->Module
    3. Inside the Module1 code, paste the following:
    Please Login or Register  to view this content.
    And that's it!

    Just go into your spreadsheet now, and type this in:

    Please Login or Register  to view this content.
    Where A1 is the cell with the forward-slashes in it.

    I hope this helps!
    starryknight64

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: find last "/" character in a cell

    You could use this formula

    =REPLACE(A1,1,LOOKUP(2^15,FIND("/",A1,ROW(INDIRECT("1:"&LEN(A1))))),"")

  4. #4
    Registered User
    Join Date
    07-28-2004
    Posts
    8

    Re: find last "/" character in a cell

    Thanks, that works!

  5. #5
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: find last "/" character in a cell

    Here's another way...

    =REPLACE(A1,1,FIND("^^",SUBSTITUTE(A1,"/","^^",LEN(A1)-LEN(SUBSTITUTE(A1,"/","")))),"")

  6. #6
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: find last "/" character in a cell

    The danger is that the string ^^ exists in the cell in question. To avoid the disastrous effects of this, I recommend this sterling alternative:

    =REPLACE(B3,1,FIND("Cheeky Charlie is thoroughly wonderful",SUBSTITUTE(B3,"/","Cheeky Charlie is thoroughly wonderful",LEN(B3)-LEN(SUBSTITUTE(B3,"/","")))),"")


  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: find last "/" character in a cell

    lol.......................................................
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

+ 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