The instring instr() command is useful in determining if a word or combination of characters exist in a text string. It returns 0 when it doesn’t find the string. If it does it returns the position of the start of the word or collection of characters.
- It does so from left to right
- Use the instrrev() if you need right to left
- It must be an exact match – yes, it is case sensitive
Example: The activecell contains the English language pangram:
“The quick brown fox jumps over the lazy dog”
a phrase that contains all of the letters of the alphabet. ,
would return a value of 17. The “f” in fox is the 17th character in our string.
would return a value of 0 as the command is case sensitive.
would return a value of 42. The “f” in last fox reading right to left is the 42nd character in our string.