Hi Bernie
I tried your code, it seem to be doing the search from left to right.
"Bernie Deitrick" wrote:
nc,
You can use a user-defined-function. Copy the code below, and paste it into
a module in your workbook. Then use it like:
=RSEARCH(find_text,within_text)
=RSEARCH("Bernie","Bernie, you are Bernie")
=RSEARCH(A2, A1)
And, if you don't like UDF's then you can use the array function (entered
with Ctrl-Shift-Enter)
=MAX(IF(ISERROR(SEARCH(A2,A1,ROW(INDIRECT("A1:A"&L EN(A1))))),0,SEARCH(A2,A1,
ROW(INDIRECT("A1:A"&LEN(A1))))))
where A1 is the string to be searched, and A2 is the string to be found, for
both of the above cases.
HTH,
Bernie
MS Excel MVP
Public Function RSearch(strFindText As String, _
strWithinText As String) As Integer
Dim i As Integer
For i = Len(strWithinText) To 1 Step -1
If InStr(i, strWithinText, strFindText) 0 Then
RSearch = i
Exit Function
End If
Next i
End Function
"nc" wrote in message
...
Hi
The following function reads from left to right
SEARCH(find_text,within_text,start_num)
Can anyone please help I need the same function but reading from right to
left.
Thanks.
|