Thread: find in reverse
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default find in reverse

Ok, I knew it had to be "easier".

x234x678x0

Find the position of the last instance of "x":

=SEARCH("^^",SUBSTITUTE(A1,"x","^^",LEN(A1)-LEN(SUBSTITUTE(A1,"x",""))))

Note that SUBSTITUTE is case sensitive. So X and x don't match!

--
Biff
Microsoft Excel MVP


"T. Valko" wrote in message
...
Try this...

Seems like it should be easier than this.

x234x678x0

Find the position of the last instance of "x":

=LOOKUP(1E100,SEARCH("x",MID(A1,ROW(INDIRECT("1:"& LEN(A1))),1)),ROW(INDIRECT("1:"&LEN(A1))))

--
Biff
Microsoft Excel MVP


"smw" wrote in message
...
I need to find the last occurrence of a character in a string.
Does anyone know of a way to make find() search from the end of a string,
rather than from the beginning.

Thank you
Steven Wheeler