INSTRREV(stringcheck, stringmatch [,start] [,compare])

Returns the position of a substring within a larger string, starting at the end (Long).

stringcheckThe text string containing your substring (String).
stringmatchThe text string to look for (String).
start(Optional) The number of the character to start looking from.
compare(Optional) A vbCompareMethod constant specifying the type of string comparison to use (Integer):
-1 = vbUseCompareOption (uses the "Option Compare" setting)
0 = vbBinaryCompare (default, case sensitive)
1 = vbTextCompare
2 = vbDatabaseCompare (uses an Access database)

* This function is similar to INSTR except it starts searching at the end of the string, rather than at the beginning.
* This function makes it very easy to parse a folder/file path and return just the filename.
* Although this function searches from the right hand side of the string, it counts characters from the left (the same as Instr).
* If "stringcheck" = "" (zero length string), then 0 is returned.
* If "stringcheck" is Null, then Null is returned.
* If "stringmatch" = "" (zero length string) then "start" is returned.
* If "stringmatch" cannot be found in "stringcheck" then 0 is returned.
* If "stringmatch" is Null, then Null is returned.
* If "start" > Len("stringcheck"), then 0 is returned.
* If "start" if left blank, then -1 is used (meaning the last character).
* If "start" is Null, then an error occurs.
* If "compare" is left blank, then -1 is used. If there is no Option Compare statement provided then vbBinaryCompare (0) is used.
* If "compare" is null, then an error occurs.
* If "compare" is provided, then "start" must also be provided.
* You can use the INSTR function to start at the beginning.
* This function was added in Office 2000.
* The equivalent .NET function is Microsoft.VisualBasic.Strings.InStrRev
* For the Microsoft documentation refer to

InstrRev("C:\Temp\","C:\") = 1 

© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited Top