4/25/2025

how to count cells containing specific text in google sheets

IN SUMMARY

Google Sheets provides the COUNTIF function to count cells containing specific text. This function allows you to count cells based on a condition, such as containing a specific word or phrase.

Counting Cells with Exact Text Match

To count cells containing an exact text match, use the COUNTIF function with the following syntax: =COUNTIF(range, criteria). For example, to count cells in the range A1:A10 that contain the word 'apple', use =COUNTIF(A1:A10, "apple"). This function is case-insensitive by default.

If you need to make the count case-sensitive, you can use the COUNTIF function with the EXACT function. For example, =COUNTIF(A1:A10, EXACT("Apple")) will only count cells containing the word 'Apple' with the same capitalization.

To count cells containing a partial text match, you can use wildcards with the COUNTIF function. For example, =COUNTIF(A1:A10, "*apple*") will count cells containing the word 'apple' anywhere within the cell value.

Counting Cells with Wildcard Text Match

The COUNTIF function supports the use of wildcards, which can be helpful when you want to count cells containing text that matches a specific pattern. The asterisk (*) wildcard represents any sequence of characters, while the question mark (?) wildcard represents any single character.

To count cells starting with specific text, use the wildcard syntax =COUNTIF(range, "text*"). For example, =COUNTIF(A1:A10, "app*") will count cells in the range A1:A10 that start with 'app'.

To count cells ending with specific text, use the wildcard syntax =COUNTIF(range, "*text"). For example, =COUNTIF(A1:A10, "*le") will count cells in the range A1:A10 that end with 'le'.

Advanced Techniques

The COUNTIFS function allows you to count cells based on multiple criteria. For example, =COUNTIFS(A1:A10, "*apple*", B1:B10, ">10") will count cells in the range A1:A10 that contain 'apple' and have a corresponding value greater than 10 in the range B1:B10.

Google Sheets supports regular expressions, which can be used with the COUNTIF function for more advanced text matching. For example, =COUNTIF(A1:A10, "^app.*") will count cells in the range A1:A10 that start with 'app' and are followed by any characters.

If you're looking to automate your spreadsheet tasks, you can use Mage (usemage.com) and its AI functions. For example, =AI("Count cells containing 'apple' in range A1:A10") will count the cells containing 'apple' in the specified range.

Want to automate your busy work in Google Sheets with AI?

Videos