Using Google Sheets’ COUNTA
and COUNTIF
functions, you can count cells that contain any text, specific text, or partially matching text. This is a great way to find the non-blank cells in your spreadsheets, and we’ll show you how to use these functions.
RELATED: How to Count Characters in a Cell in Google Sheets
Which Cell Counting Method to Use?
If you’re looking to find the count of cells that contain any text or numbers, use the first method below. It counts the number of all non-blank cells in your specified data range.
If you’d like to find the number of cells that contain a specific string of text or numbers, use the second method below. It lets you specify your text string, and then it only counts those cells that have your text string.
Lastly, if you want to count cells that contain your specified text plus any other content, use the third method below. This method will count your cells as long as they have your text in them.
Count Cells That Contain Any Text
To get the number of cells that contain any text or numbers, use the COUNTA
function in your spreadsheet as follows.
First, open your spreadsheet and click the cell in which you want to see the result.
In your selected cell, type the following function. In the function, replace C2:C11
with your data range. Then press Enter.
=COUNTA(C2:C11)
In your selected cell, you will see the number of cells that contain any text or numbers.
And you’re done.
Count Cells That Match Specific Text
To view the number of cells that contain only your specified text, use Sheets’ COUNTIF
function as follows.
First, in your spreadsheet, click the cell where you want to see the result.
In your selected cell, enter the following function. Replace C2:C11
with your data range and Mahesh
with the text you want a cell to have for it to be counted.
=COUNTIF(C2:C11,”Mahesh”)
Then press Enter.
In the selected cell, you will see the number of cells that have your specified text.
Enjoy!
Count Cells That Contain Specific Text Anywhere
To count the cells that have your specified text or numbers anywhere in them, use the COUNTIF
function with a wildcard character as follows.
In your spreadsheet, click the cell where you want to get the result.
In your selected cell, type the following function. In this function, replace C2:C11
with your data range and Mahesh
with the text you want a cell to have for it to be counted. Then press Enter.
We’ve added an asterisk (*) before and after the text string so that the function counts your cells no matter where your string is located in the cell.
=COUNTIF(C2:C11,"*Mahesh*")
In the resulting cell, you will find that the function has counted all your cells that contain your specified text anywhere in them.
And you’re all set.
In case you’re interested in doing the reverse of the above, which is to count all blank cells, there’s an easy way to do that in Google Sheets.