DCount Function

Counts delimited fields in a string.

Syntax

DCount (string, delimiter)

string is the string to be searched. If string is an empty string, 0 is returned. If string is a null value, null is returned.

delimiter is one or more characters delimiting the fields to be counted. If delimiter is an empty string, the number of characters in string + 1 is returned. If delimiter is a null value, a runtime error occurs. Two consecutive delimiters in string are counted as one field.

Remarks

DCount differs from Count in that it returns the number of values separated by delimiters rather than the number of occurrences of a character string.

Example

* The next line returns the number of substrings 
* delimited by "A"s in the string (4)
MyCount = DCount("ABCAGHDALL", "A")
* The next line returns 3 since overlapping substrings 
* are not counted.
MyCount = DCount ("TTTT", "TT")