How to Use COUNTIF with Wildcards in Google Sheets

Using COUNTIF with wildcards in Google Sheets allows you to count cells based on partial matches or specific patterns. The two wildcard characters available in Google Sheets are:

  1. The asterisk (*) - Represents any number of characters (including zero characters).
  2. The question mark (?) - Represents a single character.

Here's how to use COUNTIF with wildcards in Google Sheets:

  1. Open your Google Sheets document.
  2. Click on the cell where you want to display the count result.
  3. Enter the COUNTIF formula with wildcards. The basic syntax for the COUNTIF function is =COUNTIF(range, criterion). To use wildcards, include them in the criterion argument, which should be enclosed in double quotation marks.

Here's an example:


Suppose you have a list of names, and you want to count how many names start with the letter "A". You can use the COUNTIF function with an asterisk (*) wildcard.

  1. In the example, let's say the names are in cells A1 to A10.
  2. Click on the cell where you want to display the count result (e.g., B1).
  3. Enter the formula =COUNTIF(A1:A10, "A*").

This formula will count all the cells in the range A1:A10 that start with the letter "A", regardless of what comes after "A". The asterisk (*) wildcard represents any number of characters after "A".

If you want to count cells with a specific pattern, you can use the question mark (?) wildcard. For example, if you want to count cells with exactly 3 characters, you can use the formula =COUNTIF(A1:A10, "???"). The three question marks represent three characters.

Remember to enclose the criterion argument, including the wildcards, in double quotation marks.

Did you find this useful?