How to count cells in Google Sheets

Jugo Mobile
By
Jugo Mobile
Jugo Mobile is a platform dedicated to high-quality content in gaming, sports, and tech. Engage with high-quality content and connect with fellow enthusiasts and experts. Explore...
11 Min Read

When you’re compiling a spreadsheet in Google Sheets, you may need to know the number of certain cells. Different Google Sheets functions and formulas are usually used to count blank and non-blank cells. This task may seem complicated to new Google Sheets users, but once you master it, you’ll see that counting cells in this online program is just a matter of designated steps.

In this article, we’ll show you how to count various types of cells in Google Sheets, including text cells, selected cells, filtered cells, and more.

How to count cells in Google Sheets

If your Google Sheets document only has a few columns and rows, you can always count the number of cells manually. However, if the spreadsheet contains a large database, knowing how to use formulas to count cells in Google Sheets can save you a lot of time.

To count cells in Google Sheets, we will use some special formulas. Specifically, COUNT functions are used to count the number of cells that fall within a specific data range. The two most common and useful types of COUNT functions in Google Sheets are COUNT and COUNT.

The COUNTA formula indicates the number of numerical values ​​within a data set. The COUNTIF formula is used to determine a conditional count in a range. It is written like this: COUNTIF (range, criterion), where the range is compared to the criterion. Sometimes you can use the SUMPRODUCT formula, which shows the sum of products of corresponding ranges in two arrays.

How to count cells in Google Sheets by color

There is no direct way to count the number of cells based on the background color. Instead, you’ll have to use a custom function with Google Apps Script.

First, you will need to copy this code.

“function countCellColored(countRange,colorRef) {

var activeRg = SpreadsheetApp.getActiveRange();

var activeSht = SpreadsheetApp.getActiveSheet();

var activeFormula = activeRg.getFormula();

var countRangeAddress = activeformula.match(/\((.*)\,/).pop().trim();

var backGrounds = activeSht.getRange(countRangeAddress).getBackgrounds();

var colorRefAddress = activeformula.match(/\,(.*)\)/).pop().trim();

var Background = activeSht.getRange(colorRefAddress).getBackground();

var cellcount = 0;

for (var i = 0; i

for (var k = 0; k

yes (funds[i][k] == Background)

countCells = countCells + 1;

return cellcount;

};”

This is how you can use this code to count cells in Google Sheets by color.

  1. Open Google Sheets.
    1712105317 836 How to count cells in Google Sheets
  2. Find the spreadsheet you want to edit.
    1712105317 581 How to count cells in Google Sheets
  3. Navigate to “Extension” in the menu and then to “Apps Script.”
    1712105317 675 How to count cells in Google Sheets
  4. Delete the code in the Google Apps Script window.
    1712105317 228 How to count cells in Google Sheets
  5. Paste the code provided above.
    1712105317 44 How to count cells in Google Sheets
  6. Save your changes by clicking the disk icon at the top of the page.
    1712105317 581 How to count cells in Google Sheets
  7. Close the Google Apps Script window.
    1712105317 629 How to count cells in Google Sheets
  8. Enter “=COUNTCOLOREDCELLS” in any empty cell on the spreadsheet.
    1712105317 355 How to count cells in Google Sheets
  9. Type the range in parentheses, as in this example: “=COUNTCOLOREDCELLS (A12:D15)”.
    1712105317 213 How to count cells in Google Sheets
  10. Press “Enter” on your keyboard.

The number of colored cells will appear in the cell where you entered the formula.

How to count text cells in Google Sheets

In most cases, you will be prompted to count cells with text. It doesn’t matter what type of text the cells contain; They could be numbers, dates, names, etc. Note that there is a difference between counting cells with specific and non-specific text. We will use the COUNTIF formula for both.

To count non-specific text cells in Google Sheets, here’s what you need to do.

  1. Open Google Sheets.
    1712105317 836 How to count cells in Google Sheets
  2. Locate the spreadsheet you want to use.
    1712105317 581 How to count cells in Google Sheets
  3. Double click on an empty cell where the COUNT results will be.
    1712105318 645 How to count cells in Google Sheets
  4. Type the formula “=COUNTIF” in the selected empty cell, or simply select it from the list of suggestions.
    1712105318 748 How to count cells in Google Sheets
  5. Select the text cells you want to count by dragging the mouse over the range. Be
    is automatically added to the COUNTIF formula. For example: “=COUNTIF(B4:C7” is what you are supposed to write for now (there are no closing parentheses yet).
    Note: Another way to do this is to manually type the range after the opening parenthesis. For example, “(A7:C11”.
    1712105318 162 How to count cells in Google Sheets
  6. Put the rating criteria in quotation marks (for example, “>20”). This is the only time we will use quotes in the formula. The criteria you use depends on the content of the cells.
    1712105318 796 How to count cells in Google Sheets
  7. Add the closing parenthesis.
    1712105318 271 How to count cells in Google Sheets
  8. Press the “Enter” key.

The number of text cells will appear in the cell where you entered the formula

How to count selected cells in Google Sheets

To count the number of selected cells in Google Sheets, you can use the COUNTA formula. This is how you do it.

  1. Gonna Google Sheets in your browser.
    1712105317 836 How to count cells in Google Sheets
  2. Find the spreadsheet you want to use.
    1712105317 581 How to count cells in Google Sheets
  3. Double-click any empty cell in the spreadsheet.
    1712105318 612 How to count cells in Google Sheets
  4. Type “=COUNT” in the cell.
    1712105318 422 How to count cells in Google Sheets
  5. Select the cells you want to count by clicking on the range and dragging the cursor over it. You can also enter the range in parentheses, as in the following example: “=COUNT(A1:B10)”.
    1712105318 905 How to count cells in Google Sheets
  6. Press “Enter” on your keyboard.
    1712105318 824 How to count cells in Google Sheets

You will see the number of selected cells in the same cell where you wrote the formula. We will not use quotes in the COUNT formula.

How to count filtered cells in Google Sheets

If you want to count cells with specific words, you can use the COUNTIF formula. For example, if you want to count all cells that contain the word “product”, the COUNTIF formula is ideal for this. Follow the steps below to see how it works.

  1. Run Google Sheets and locate your spreadsheet.
    1712105317 836 How to count cells in Google Sheets
  2. Double-click anywhere on the spreadsheet.
    1712105318 74 How to count cells in Google Sheets
  3. Type “=COUNTIF”.
    1712105318 891 How to count cells in Google Sheets
  4. In parentheses, add the range. For example: “(A3:B10)”.
    1712105319 669 How to count cells in Google Sheets
  5. Add a comma.
    1712105319 444 How to count cells in Google Sheets
  6. Enter the filter word in quotes. This is what the formula “=COUNTIF(A3:B10, “product”)” is supposed to look like.
    1712105319 650 How to count cells in Google Sheets
  7. Press “Enter.”

How to Count Bold Cells in Google Sheets

As with colored cells, there is no function you can use to count the number of bold cells in Google Sheets. You will need to use a custom formula with Google Apps Script. This is how you do it.

  1. Open Google Sheets and go to your spreadsheet.
    1712105317 836 How to count cells in Google Sheets
  2. Navigate to “Extension” in the top menu.
    1712105319 344 How to count cells in Google Sheets
  3. Select “Apps Script” from the list of options. This will take you to Google Apps Script.
    1712105317 675 How to count cells in Google Sheets
  4. Remove the code that is already there.
    1712105317 228 How to count cells in Google Sheets
  5. Copy and paste the following formula into the Code.gs window.
    “function count cells in bold() {
    var book = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = book.getActiveSheet();
    var range_input = sheet.getRange(“E2:S7”);
    var range_output = sheet.getRange(“G14”);
    var cell_styles = range_input.getFontWeights();
    variable count = 0; for(var r = 0; r for(var c = 0; c if(cell_styles[r][c] === “bold”) {
    count = count + 1;
    }
    }
    }
    range_output.setValue(count)
    }”

    1712105319 254 How to count cells in Google Sheets
  6. Select the “Save” icon above the code.
    1712105319 1 How to count cells in Google Sheets
  7. Close the Google Apps script.
    Now that you’ve added the ability to count bold cells in Google Sheets, here’s what you need to do next.
    1712105319 735 How to count cells in Google Sheets
  8. Type “=COUNTBOLDCELLS” in an empty cell.
    1712105319 223 How to count cells in Google Sheets
  9. Enter the range, for example: “(A1:B10)”.
    1712105319 739 How to count cells in Google Sheets
  10. Press the “Enter” key.

All cells in bold will be counted and the results will be displayed in that cell.

How to count blank cells in Google Sheets

Google Sheets allows you to count cells that do not contain text. These are called blank cells. We will count them using the COUNT BLANK formula. This is how you do it.

  1. Launch Google Sheets and open your spreadsheet.
    1712105317 836 How to count cells in Google Sheets
  2. Choose any empty cell in the spreadsheet and double-click it.
    1712105319 808 How to count cells in Google Sheets
  3. Enter “=COUNT BLANK” in the empty cell.
    1712105320 589 How to count cells in Google Sheets
  4. Type the range of cells in parentheses, as in the example: “=COUNT BLANK (A:D)”.
    1712105320 237 How to count cells in Google Sheets
  5. Press “Enter.”
    1712105320 775 How to count cells in Google Sheets

That’s all about it. The number of blank cells will appear in that cell.

Note that Google Sheets differentiates between blank and empty cells. If there is an empty text string in a cell, Google Sheets sees it as an empty cell, not blank.

How to count non-blank cells in Google Sheets

To count non-blank cells in Google Sheets, we will use the COUNT function. This function is used to count cells that contain a text string or some type of value within a range. If there are blank cells between text cells, the COUNT function will not select them.

Follow the steps below to count non-blank cells in Google Sheets.

  1. Open Google Sheets and go to your spreadsheet.
    1712105317 836 How to count cells in Google Sheets
  2. Choose an empty cell anywhere on the spreadsheet.
    1712105320 968 How to count cells in Google Sheets
  3. Enter “=COUNT” in the empty cell.
    1712105320 568 How to count cells in Google Sheets
  4. Type the range of cells in parentheses, for example: “(B5:B20)”.
    1712105320 837 How to count cells in Google Sheets
  5. Press “Enter” on your keyboard.
    1712105320 582 How to count cells in Google Sheets

The number of non-blank cells within a range will appear in the cell. If your spreadsheet has hidden or special characters, the COUNT function cannot help you. In these cases, it is better to use the COUNTIF or SUMPRODUCT function.

Count cells like a pro

Using Google Sheets can be complicated at first, especially if you’ve never used its formulas before. If you need to count specific cells in your spreadsheet, there is probably a formula that can help you. Otherwise, you’ll have to use a custom formula with Google Apps Script.

Share This Article
Follow:
Jugo Mobile is a platform dedicated to high-quality content in gaming, sports, and tech. Engage with high-quality content and connect with fellow enthusiasts and experts. Explore the latest trends and innovations in our vibrant community. Join us and experience the future today!
Leave a Comment
Grow your brand and reach a larger audience. Advertise with us today and get noticed by thousands.
© 2025 Jugo Mobile. All Rights Reserved.