If you need to count the number of cells begin with certain text, you can easily do so with the COUNTIF function. In the generic form of the formula (above) rng is a range of cells, txt represents the text that cells should begin with, and “*” is a wildcard matching any number of characters.
In the example, the active cell contains this formula:
Here’s how the formula works:
COUNTIF counts the number of cells in the range that begin with txt by matching the content of each cell against the pattern “txt*”, which is supplied as the criteria. The “*” symbol (the asterisk) is a wildcard in Excel that means “match any number of characters”. The count of cells that match this pattern is returned as a number.