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.

COUNTSTRING (single-text-expression , single-text-expression)
COUNTSTRING (text_to_search , text_to_find_and_count)
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.


  • COUNTSTRING ( "banana" , "a" )

    Returns a value of 3

  • COUNTSTRING ( "aaaa" , "aa" )

    Returns a value of 3.

Related functions

  • FIND
  • LEFT
  • MID