Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default worksheet function for InStrRev()

Is there such a thing? I know there's SEARCH() which is equivalent to
InStr() in VBA but now we have InStrRev() which searches for a string from
the end rather than the beginning. Be a lot more useful than CRITBINOM() etc!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default worksheet function for InStrRev()

Here is one way

=MAX(IF(MID(A10,ROW(INDIRECT("1:"&LEN(A10))),1)="~ ",ROW(INDIRECT("1:"&LEN(A1
0)))))

which is an array formula, it should be committed with Ctrl-Shift-Enter, not
just Enter.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Martin" wrote in message
...
Is there such a thing? I know there's SEARCH() which is equivalent to
InStr() in VBA but now we have InStrRev() which searches for a string from
the end rather than the beginning. Be a lot more useful than CRITBINOM()

etc!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default worksheet function for InStrRev()

=FIND("~",SUBSTITUTE(D6,"the","~",(LEN(D6)-LEN(SUBSTITUTE(D6,"the","")))/LEN
("the")))

Entered with Ctrl+Shift+Enter since it is an array formula.

Searches for the last occurance of "the" as an example.

--
Regards,
Tom Ogilvy


"Martin" wrote in message
...
Is there such a thing? I know there's SEARCH() which is equivalent to
InStr() in VBA but now we have InStrRev() which searches for a string from
the end rather than the beginning. Be a lot more useful than CRITBINOM()

etc!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default worksheet function for InStrRev()

thanks, both to Tom and Bob.

Another way I've just found is to create a VBA user function in a module
(best in personal.xls so it's always available):

Function myReverse(stringtocheck As String, stringtomatch As String, startas
As Long)
myReverse = InStrRev(stringtocheck, stringtomatch, startas)
End Function


"Tom Ogilvy" wrote:

=FIND("~",SUBSTITUTE(D6,"the","~",(LEN(D6)-LEN(SUBSTITUTE(D6,"the","")))/LEN
("the")))

Entered with Ctrl+Shift+Enter since it is an array formula.

Searches for the last occurance of "the" as an example.

--
Regards,
Tom Ogilvy


"Martin" wrote in message
...
Is there such a thing? I know there's SEARCH() which is equivalent to
InStr() in VBA but now we have InStrRev() which searches for a string from
the end rather than the beginning. Be a lot more useful than CRITBINOM()

etc!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel error: Undefined Function 'InStrRev' in Expression TerryD Excel Worksheet Functions 4 February 6th 07 02:43 PM
Strange behavior of InStrRev() function Windowed Excel Programming 2 September 12th 05 01:56 AM
is there a instrRev function in excel functions? schuurke28 Excel Worksheet Functions 1 October 28th 04 03:05 PM
is there a instrRev function in excel functions? schuurke28 Excel Worksheet Functions 1 October 28th 04 11:25 AM
InStrRev function not working? Michal Rosa Excel Programming 1 January 26th 04 04:14 AM


All times are GMT +1. The time now is 06:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"