Intro
Learn how to use Countif in Google Sheets to count cells containing specific text, phrases, or keywords, with step-by-step guides and examples for text-based filtering and conditional counting.
The COUNTIF function in Google Sheets is a powerful tool for counting cells that meet specific criteria, including containing specific text. To use COUNTIF for counting cells that contain text, you follow a straightforward syntax. Here's how you can do it:
You start by selecting the cell where you want to display the count, then you type =COUNTIF(range, criterion)
. The range
is the group of cells you want to check, and the criterion
is the condition that determines which cells to count. If you're looking for cells that contain specific text, your criterion would include an asterisk (*
) as a wildcard character. The asterisk represents any sequence of characters.
For example, if you want to count all cells in column A that contain the word "example", your formula would look like this:
=COUNTIF(A:A, "*example*")
Here's a breakdown of how this works:
A:A
specifies the range as the entire column A."*example*"
is the criterion. The asterisks before and after "example" mean that the cell can contain any characters before or after "example" and still be counted.
Using COUNTIF with Multiple Criteria
If you need to count cells based on multiple criteria, including text, you can combine the COUNTIF function with other functions like SUMPRODUCT or use an array formula. However, for straightforward multiple criteria, using COUNTIFS (with an S at the end) is more straightforward:
=COUNTIFS(range1, criterion1, [range2], [criterion2],...)
For instance, to count cells in column A that contain "example" and are in rows where column B contains "test":
=COUNTIFS(A:A, "*example*", B:B, "*test*")
Practical Applications
-
Inventory Management: You can use COUNTIF to count how many items in your inventory list contain a specific keyword, like "electronic" or " perishable".
-
Customer Feedback Analysis: COUNTIF can help you analyze customer feedback by counting how many comments contain positive or negative keywords.
-
Financial Analysis: In financial spreadsheets, you might use COUNTIF to count transactions that contain specific descriptions, like "salary" or "rent".
Tips for Using COUNTIF
- Case Sensitivity: The COUNTIF function is case-sensitive. If you want a case-insensitive search, you can convert both the range and criterion to lower or upper case using the LOWER or UPPER function. For example:
=COUNTIF(LOWER(A:A), "*example*")
- Error Handling: If the range is empty, COUNTIF returns 0. However, if your criterion is not found, it also returns 0. Make sure to test your criteria to ensure they're correct.
- Performance: For very large datasets, using COUNTIF can slow down your spreadsheet. Consider using Google Sheets' filtering capabilities or pivot tables for data analysis when dealing with large datasets.

Advanced COUNTIF Techniques
For more complex counting tasks, you might need to combine COUNTIF with other Google Sheets functions. For example, using COUNTIF with the IF function can allow you to count cells based on multiple conditions that are not necessarily related to the cell's content directly.
Common Errors with COUNTIF
- #N/A Error: This can occur if your criterion is not correctly formatted or if there's a typo.
- #VALUE! Error: This error happens if the criterion argument is not a number, text, or a reference to a cell containing a number or text.
Alternatives to COUNTIF
- QUERY Function: The QUERY function allows you to perform more complex queries on your data, including filtering and counting based on specific conditions.
- FILTER Function: While not directly a counting function, FILTER can be used with other functions like COUNTA to achieve similar results to COUNTIF.

Best Practices
- Keep Your Data Organized: A well-organized dataset makes it easier to apply COUNTIF and other functions effectively.
- Test Your Criteria: Always test your criteria on a small subset of your data to ensure they're working as expected.
- Use Relative and Absolute References Wisely: Understand the difference between relative and absolute references (
A1
vs.$A$1
) and use them appropriately in your COUNTIF formulas.

Conclusion and Next Steps
Mastering the COUNTIF function in Google Sheets can significantly enhance your ability to analyze and understand your data. Whether you're managing inventory, analyzing customer feedback, or performing financial analysis, COUNTIF is a versatile tool that can help. By following the tips and best practices outlined above and experimenting with the function in your own spreadsheets, you'll become more proficient in using COUNTIF to contain text and unlock more insights from your data.

Gallery of COUNTIF Google Sheets
COUNTIF Google Sheets Image Gallery










What is the COUNTIF function in Google Sheets?
+The COUNTIF function is used to count the number of cells in a range that meet a specific condition or criterion.
How do I use COUNTIF to count cells containing specific text?
+To count cells containing specific text, use the formula =COUNTIF(range, "*text*"), where "range" is the group of cells to check, and "text" is the specific text you're looking for.
Can I use COUNTIF with multiple criteria?
+
What are some common errors when using COUNTIF?
+Common errors include #N/A and #VALUE! errors, which can occur due to incorrect formatting of the criterion or typos.
What are some alternatives to using COUNTIF?
+Alternatives include using the QUERY function or combining FILTER with other functions like COUNTA.