VBA InStrRev Function: The InStrRev function in Excel VBA returns an integer representing the position of a substring within the specified string if the substring is fount else it returns the value 0. It searches the string from right to left (i.e. from the end to the start of the string).

Syntax

Parameter

StringCheck (required) – This parameter represents the string you want to search.

StringMatch (required)– This parameter represents the substring you want to search for.

Start (optional)– This parameter represents an integer argument, representing the position that you want to start the searching. The default value is -1 (search starts from the end of the string).

Compare (optional) – This parameter represents the type of comparison to make.

It can take any of the following values:

  • vbBinaryCompare: To perform a binary comparison
  • vbTextCompare: To perform a text comparison
  • vbDatabaseCompare: To perform a database comparison

Return

This function returns an integer representing the position of a substring within the specified string if the substring is fount else it returns the value 0.

Example 1

Output

10

VBA InStrRev Function

Example 2

Output

15

VBA InStrRev Function

Example 3

Output

0

VBA InStrRev Function

Pin It on Pinterest

Share This