Using Excel's COUNTIF function is an effective way to analyze and manage data within your spreadsheets. One of its most useful applications is in counting cells that contain partial text matches. This can be particularly handy when you need to identify patterns or trends in your data that are not immediately apparent. In this article, we will explore five ways to use Excel's COUNTIF function for partial text, enabling you to refine your data analysis and reporting skills.
Understanding the COUNTIF Function

The COUNTIF function in Excel is designed to count cells within a specified range that meet a single criterion. The syntax for the COUNTIF function is COUNTIF(range, criteria)
, where range
is the range of cells you want to search, and criteria
is the condition you want to apply. For partial text matching, we use wildcards within the criteria.
Using Wildcards for Partial Text Matches
Excel recognizes two types of wildcards for text searches:
- Asterisk (
*
): Represents any sequence of characters. - Question mark (
?
): Represents a single character.
To count cells that contain a specific partial text, you can include these wildcards in your criteria.
1. Counting Cells Containing Specific Partial Text

For example, to count all cells in column A that contain the text "example", you would use:
=COUNTIF(A:A, "*example*")
This formula searches for the word "example" anywhere within the text of cells in column A.
Counting Multiple Criteria
If you need to count cells based on multiple criteria, you might initially think to use the COUNTIFS function, which allows for multiple range/criteria pairs. However, for partial text matches, sticking with COUNTIF and incorporating multiple wildcards or criteria with the &
operator can be effective.
2. Using Multiple Wildcards for Complex Matches

For instance, to count cells that contain both "example" and "text":
=COUNTIF(A:A, "*example*") + COUNTIF(A:A, "*text*")
Or, to count cells that contain either "example" or "text":
=COUNTIF(A:A, "*example*") + COUNTIF(A:A, "*text*") - COUNTIF(A:A, "*example*text*")
Note the subtraction of the overlap in the latter formula to avoid double-counting cells that contain both terms.
3. Using COUNTIF with Conditional Formatting

You can also use the COUNTIF function in combination with Excel's conditional formatting feature to highlight cells that contain specific partial text. This is especially useful for visual analysis and quick identification of patterns.
Step-by-Step to Highlight Cells
- Select the range of cells you want to format.
- Go to the Home tab > Conditional Formatting > New Rule.
- Choose "Use a formula to determine which cells to format".
- Enter your COUNTIF formula, adjusting it to return TRUE for the condition you're interested in, e.g.,
=COUNTIF(A1, "*example*")>0
. - Choose your desired format and click OK.
4. Combining COUNTIF with Other Functions

COUNTIF can be combined with other Excel functions to perform more complex analyses. For example, using it with the SUMIFS function can help calculate totals based on partial text matches in another column.
Example: Summing Values Based on Partial Text
Suppose you want to sum all values in column B where the corresponding text in column A contains "example":
=SUMIFS(B:B, A:A, "*example*")
5. Using COUNTIF for Partial Text in Dates

While COUNTIF is more commonly associated with text, it can also be used with dates by formatting the date cells as text or by using the TEXT function to convert the dates to a text format that can be searched.
Example: Counting Dates Containing Specific Text
If your dates are formatted as text (e.g., "2023-02-15" as "February 2023"), you can count dates that contain specific text like this:
=COUNTIF(TEXT(A:A, "mmmm yyyy"), "*February*")
This formula counts all cells in column A that contain the text "February".
Gallery of COUNTIF Function Examples
COUNTIF Function Examples Gallery










With these examples and techniques, you're equipped to harness the power of Excel's COUNTIF function for a wide range of partial text matching tasks. Whether you're a beginner looking to expand your Excel skills or an advanced user seeking more efficient ways to analyze data, COUNTIF is a versatile tool that can help you achieve your goals.
So, how do you plan to use the COUNTIF function for partial text matching in your Excel spreadsheets? Share your thoughts and examples in the comments below.