Get instant live expert help with Excel or Google Sheets
“My Excelchat expert helped me in less than 20 minutes, saving me what would have been 5 hours of work!”

Post your problem and you'll get expert help in seconds

Your message must be at least 40 characters
Our professional experts are available now. Your privacy is guaranteed.

How to Count Cells that Contain Specific Text

Analyzing large chunks of data often requires to count cells containing specific text. Excel allows us to do it in a simple way. We can use the COUNTIF function to count cells that contain specific text. In this tutorial, we will learn how to count cells that contain specific text.

Figure 1. Example of Counting Cells that Contain Specific Text

Generic Formula

=COUNTIF(range,"*text*")

  • Range: This value is required. It is the range of cells where we want to count the text.
  • Text: This value is also required. It is the specific text that we want to cout. Here, the asterisk sign (“*”) represents a wildcard that matches any number of characters.

How the Formula Works

Here, COUNTIF counts the total cells containing the provided text in the range. It matches the content of the cells against the wildcard pattern. This wildcard matches any number of characters. Thus, itl counts all cells containing the text in any position. Excel returns the total number of time the text arrives in the range.

Setting Up Data

The following example uses an employee information data set. Column A, B and C has the employee names, ID and departments.

Figure 2. The Sample Data

To find the total number of employees from the HR department:

  • Go to cell F4.
  • Assign the formula =COUNTIF(C2:C6,"*HR*") to cell F4.
  • Press Enter.

Figure 3. Applying the Formula to Count Cells Containing Specific Text

This will show the number of employees in the HR department in cell F4.

Notes

We can change the previous formula to use the contents of another cell as the text criteria. To find the number of employees in the HR department using the ID’s, we need to use the formula:

=COUNTIF(B2:B6,"*"&C2&"*")

Figure 4. Using the Wildcard to Count Cells that Contain Specific Text

This shows the same result as before using the text HR from the cell C2 to look into the ID’s that matches the text HR.

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:

Leave a Comment

avatar

Subscribe to Excelchat.co

Get updates on helpful Excel topics

Subscribe to Excelchat.co

Did this post not answer your question?
Get a solution from connecting with the expert

Another blog reader asked this question today on Excelchat:

Post your problem and you'll get expert help in seconds

Your message must be at least 40 characters
Our professional experts are available now. Your privacy is guaranteed.
Trusted by people who work at
Amazon.com, Inc
Facebook, Inc
Accenture PLC
Siemens AG
Macy's
The Allstate Corporation
United Parcel Service
Dell Inc