Thread: find in reverse
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default find in reverse

Sorry, I meant to use 99, not 15 for the ROW array (still array-entered)...

=MAX((MID(A1,ROW(1:99),1)="x")*ROW(1:99))

I used 15 originally for debugging purposes and then forgot to reset it
afterwards. For the OP... the formula (with the 99s) assumes your text in A1
will not be longer than 99 characters. If it could be, just change both 99s
to a (same) value equal to or larger than the maximum number of characters
that can appear in A1.

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
You can also do it with this array-entered** formula...

=MAX((MID(A1,ROW(1:15),1)="x")*ROW(1:15))

**commit formula using Ctrl+Shift+Enter, not just Enter by itself.

Two side benefits of the above formula is that it returns 0 as the result
if "x" is not in A1 (your formula returns a #VALUE! error) and it is case
insensitive (it finds the last "x" or "X").

--
Rick (MVP - Excel)


"T. Valko" wrote in message
...
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