COUNTSTRING
You can use the COUNTSTRING function when you need to know the number of times a specific text string appears within another text string. The function begins to look for the character string from the first position of the first string, and proceeds forward one byte at a time.
- Syntax:
- COUNTSTRING (single-text-expression , single-text-expression)
- Meaning:
- COUNTSTRING (text_to_search , text_to_find_and_count)
- Returns:
- A single-integer
COUNTSTRING returns an integer that represents the number of times that a specified character string appears in another character string.
The result is a number representing the number of times text_to_find_and_count appears within text_to_search. If either text_to_search or text_to_find_and_count evaluates to "none", COUNTSTRING returns 0.
Examples
- COUNTSTRING ( "banana" , "a" )
Returns a value of 3
- COUNTSTRING ( "aaaa" , "aa" )
Returns a value of 3.
Related functions
- FIND
- LEFT
- MID
- RIGHT