Google sheets countif cell contains partial text

=COUNTIF(A2:A6,"feb*") // criteria within formula

=COUNTIF(A:A,C6&"*") // criteria as a cell reference

A2:A6 & A:A = Ranges; C6 = Criteria

Check below for a detailed explanation with pictures and how to use formulas in Excel and Google Sheets.

Count if cells start with a specific text in Excel

How to count if cells start with specific text in Excel?

Google sheets countif cell contains partial text

COUNT CELLS THAT BEGIN WITH A SPECIFIC TEXT — EXCEL FORMULA AND EXAMPLE

  1. =COUNTIF(A2:A6,"feb*") // criteria within formula

  2. =COUNTIF(A:A,C6&"*") // criteria as a cell reference

    • A2:A6= data range

    • "feb*"= criteria and must start with feb (non-case sensitive)

    • * asterisk explanation

      • a* = "a" at start

      • *b = "b" at end

Count if cells start with a specific text in Google Sheets

How to count if cells start with specific text in Google Sheets?

Google sheets countif cell contains partial text

COUNT CELLS THAT BEGIN WITH A SPECIFIC TEXT — GOOGLE SHEETS FORMULA AND EXAMPLE

  1. =COUNTIF(A2:A6,"feb*") // criteria within formula

  2. =COUNTIF(A:A,C6&"*") // criteria as a cell reference

    • A2:A6= data range

    • "feb*"= criteria and must start with feb (non-case sensitive)

    • * asterisk explanation

      • a* = "a" at start

      • *b = "b" at end

Wild cards and regular expressions in Excel and Google Sheets

Google sheets countif cell contains partial text
Wild cards and regular expressions

Coming | Subscribe here for the custom Excel/Sheets formulas E-book (PDF) >

The COUNTIF function is used where specified criterion is single. It can be divided into two parts for further clarification;
  • IF portion of function supplies the criteria to meet for cells or data to count
  • COUNT portion of function totals the number of cells that meet that specified criteria

Basic formula for COUNTIF

The syntax for the COUNTIF function is:

=COUNTIF(range, criterion)

Where,

Range is group of cells that we need to search for. Criterion can be any of any of the followings;

  • A Number, such as 100
  • A text data or text string, such as “Grapes”
  • A cell reference where data is located in sheet, such as A1
  • An expression, such as “<=100”

There are some rules to follow depending upon data range contains number or text values while specifying the criterion in the COUNTIF function.

If the data range contains numbers:

  • Comparison operators, such as > (greater than), >= (greater than equal to), < (less than), <> (not equal to) are used in expression to check the criterion with number. The expression must be enclosed in double quotation marks, such as “<=100”
  • Equal sign (=) is not used in an expression to check equal values, such as equal to 100
  • In expressions using comparison operators and cell references, the comparison operator is joined to the cell reference using the ampersand (&).
  • Comparison operators must be enclosed in double quotation marks, whereas cell references are not enclosed in double quotation marks, such as “>=”&A1

If the data range contains numbers:

  • Text string must be enclosed in double quotation marks, such as “Grapes”
  • Text strings can contain “?” and “*” wildcard characters. To match one character “?” wildcard is used, and to match multiple contiguous characters “*” wildcard is used, such as “P?T” or “*es”

How to enter the COUNTIF function in Google Sheets

When you enter any function in Google sheets, an auto-suggest box pops up to follow that function syntax instead of a dialog box in Excel. Like when we will enter COUNTIF function in Google Sheets auto-suggest box will popup; containing syntax, example, summary related to COUNTIF function and explanation of each part of function as shown below.

Google sheets countif cell contains partial text

In this article, we will discuss the COUNTIF argument with some criterion for more clarification. Please follow these steps to enter COUNTIF function in Google Sheets.

  1. Keep your cursor in a cell where you want to show your calculations, like cell E1
  2. Enter “=” sign and type COUNTIF function in this active cell E1, an auto-suggested box pops up
  3. Select the range of cells which you want to text again your criterion
  4. Then enter comma “,”
  5. Enter criterion expression to apply at selected range
  6. Finally, press the ENTER key on the keyboard to enter the closing bracket.

Suppose we have sales dataset of some inventory items and we want to use COUNTIF function in Google Sheets to perform the following calculation on this data set.

Count of Sales Greater Than $400

Now we want to test the sales range of B2:B9 again this criterion expression of “>400”. As data range contains numeric values, so we will place the express in double quotation marks, as shown below

You can see the COUNTIF function has tested the selected sales data and counted the values against specified criterion where sales figures are greater than $400 and returned the result as 2

=COUNTIF(B2:B9,">400")

Google sheets countif cell contains partial text

Google sheets countif cell contains partial text

Now we will use comparison operator and cell reference in criterion expression to count sales that are greater than the value mentioned in cell reference, such as D2.

We will join comparison operator and cell reference by using an ampersand (&). Comparison operator will be placed in double quotation marks, whereas cell references will not be enclosed in double quotation marks, such as “>”&D2

=COUNTIF(B2:B9,">"&D2)

Google sheets countif cell contains partial text

Google sheets countif cell contains partial text

Count of Sales Equal to

IF we want to count the sales figure found in a data range that is exactly equal to a specified value, say $200, the COUNTIF function will be as follows;

=COUNTIF(B2:B9,200)

Here, we will not use the equal sign “=” as comparison operator in criterion expression and criterion numeric value will not be enclosed in double quotation marks.

Google sheets countif cell contains partial text

Count of Text value or string

We can count the number of times a text value or text string appears in data range in Google Sheets using COUNTIF functions;

=COUNTIF(B2:B16,"Utensil")

Criterion text value will be enclosed in double quotation marks, and cell reference of that value will be used in the formula without double quotation marks, like;

=COUNTIF(B2:B16,D2)

Google sheets countif cell contains partial text

Google sheets countif cell contains partial text

Here you can see that COUNTIF has returned the output as number of times (5) a text value is found in data range to test for.

Count of Text value using Wildcard

You can count any instance of a text value in a data range using wildcards, like “*” and “?”. Wildcard search is not case sensitive and it will count any instance of text value, like

=COUNTIF(A2:A9,"*Bottled*")

As criterion text value can be found anywhere in a text string of selected range, then we will place “*” wildcard in start and end of this text value.

Google sheets countif cell contains partial text

IF you have to count the occurrence of text value only at the end of a text string in the data range, then the formula would be;

=COUNTIF(A2:A9,"*Soda")

Google sheets countif cell contains partial text

Still need some help with Excel formatting or have other questions about Excel? Connect with a live Excel expert here for some 1 on 1 help. Your first session is always free. 

How do I count a cell contains part of a text in Google Sheets?

=COUNTIF(A2:A13,"*mark*") This means that where this formula checks for the given condition, there could any number of characters/words before and after the criteria. In simple terms, if the word Mark (or whatever your criterion is) is present in the cell, this formula would count the cell.

How do I use Countif with partial text?

Countif partial string/substring match with formulas Select a blank cell you will place the counting result at, type the formula =COUNTIF(A1:A16,"*Anne*") (A1:A16 is the range you will count cells, and Anne is the certain partial string) into it, and press the Enter key.

How do I make a count if a cell contains specific text?

Count Cells that Contain a Particular String Anywhere within the Cell.
Type =COUNTIF( in the cell where you want to see the count..
Select the range of cells to count..
Type a comma to go to the next argument and enter the text for which you want to search. ... .
Hit enter and you have the result:.

How do I count if a cell does not contain a specific text?

In a blank cell enter the formula =COUNTIF(A1:A40,"<>*count*") and then press the Enter key. Then you will get the number of cells which don't contain the specific text of "count" in the specific Range A1:A40.