View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Coderre
 
Posts: n/a
Default finding rightmost location of a character

You're absolutely correct.
No point in making Excel work any harder than it needs to.


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

XL2002, WinXP-Pro


"KingGeezer" wrote:

One follow-up Ron, if you're still monitoring .....
Wouldn't it be enough to stop after the 'search' function?
I get the same #, if I don't bother with the "len(left ....) parts.
Thanks; you're a star.

"KingGeezer" wrote:

Ron! replace that bronze status with a gold one!
I think this will work just fine! It'll take me longer to *analyze* how
this work, than it did for you to answer it!
many thanks!

"Ron Coderre" wrote:

Here's one way:

With your text in Cell A1
B1: =LEN(A1)+1-MATCH("/",MID(A1,LEN(A1)+1-ROW(INDIRECT("1:"&(LEN(A1)))),1),0)
Note: Commit that array formula by holding down the [Ctrl][Shift] keys and
press [Enter].

Here's another way:
B1:
=LEN(LEFT(A1,SEARCH("^^",SUBSTITUTE(A1,"/","^^",LEN(A1)-LEN(SUBSTITUTE(A1,"/",""))))-1))+1

Just press [Enter] for that one.

Does that help?

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

XL2002, WinXP-Pro


"KingGeezer" wrote:

I have a text string (a directory path actually) that has several "/"
characters in it.
I'd like to find the location of the right-most occurrance of an "/".
For example, if the string was: "mama/poppa/bogus/dog" .... how do I find
the position number of the "/" right before 'dog'?
Thanks for any help you can provide!