View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
dsimcox dsimcox is offline
external usenet poster
 
Posts: 18
Default Why doesn't INSTREV work for me?

Thank you, Rick and Mike.

That possiblity never occurred to me. I understand how it works now - but I
think I would have designed it to work the other way!

Appreciate you help this morning.

"Mike H" wrote:

Hi,

It is working for you, it returns the position of the last occurence of the
search character not the position from the right hand side

Try this

myposition = Len("1234567-89") - (InStrRev("1234567-89", "-", -1,
vbBinaryCompare) - 1)

Mike

"dsimcox" wrote:

I'm using INSTREV to retrieve the location of a character in a string by
searching from the end of the string.

When I type the following in the immediate window:

?InStrRev("1234567-89", "-")

I get an answer of 8.

I was expecting 3. (The position of the "-" is 3 characters from the
right-hand side of the string)

Am I interpreting this incorrectly?