Instr() |
Working with Formulas > Functions Used in Formulas > Text Functions > Instr()
INSTR() searches for the search string in the other string. INSTR() returns the character index of the nth occurrence of the search string in the other string, starting from the left side of the string. If no occurrence number is specified, INSTR() returns the first occurrence, starting from the left side of the string. If the search string cannot be found or the occurrence number listed runs past the end of the input string, INSTR() returns zero.
NOTE: INSTR() is an alias for LFIND()
Function Format
INSTR(string, search string [, occurrence])
Return Value
INSTR() returns an integer
Examples
INSTR("Green apples taste better than red apples and all other types of apples.", "apples") = 7
INSTR("Green apples taste better than red apples and all other types of apples.", "oranges") = 0
INSTR("Green apples taste better than red apples and all other types of apples.", "apples", 1) = 7
INSTR("Green apples taste better than red apples and all other types of apples.", "apples", 2) = 36
INSTR("Green apples taste better than red apples and all other types of apples.", "apples", 3) = 66
INSTR("Green apples taste better than red apples and all other types of apples.", "apples", 4) = 0 |