Inside The Web
    Facebook Twitter Instagram
    Inside The Web
    • Office
      • Excel
      • Ms Word
      • OneDrive
      • Google Docs
      • Google Sheets
      • Google Drive
    • Email
      • Gmail
      • Outlook
      • Emal Etiquette
    • Office Etiquette
    • Productivity
    Inside The Web
    Home»Office»Google Sheets»COUNTIF Not Blank in Google Sheets

    COUNTIF Not Blank in Google Sheets

    Asmi DhakalBy Asmi DhakalDecember 20, 2023 Google Sheets 4 Mins Read

    When creating a list, such as a grocery list, it is essential to keep count of your items. However, if your data table contains blanks in between, making this count can get a bit difficult.

    Once you select a range, Google Sheets will temporarily display the number of non-empty cells in the bottom-right corner of the browser. The count will disappear when you deselect the range.

    Get cell count GSheets

    If you want to generate the total number of non-empty cells on your spreadsheet, use the COUNT and COUNTA functions. While COUNTA displays the total number of all non-empty cells, the COUNT function calculates the count of cells containing only numbers.

    Aside from these functions, you can also create formulas using COUNTIF, COUNTBLANK, SUMPRODUCT, LEN, and TRIM to count non-blank cells in Google Sheets.

    Count Cells All Non-Blank Cells

    Function UsedDate TypeSyntax
    COUNTASTATISTICAL=COUNTA(value1, [value2,..])

    The COUNTA function counts all cells that are not empty in Google Sheets. This includes numbers, texts, strings, and even hidden characters.

    The following spreadsheet contains the favorite movies of 15 individuals.

    data sheet

    However, not everyone has filled out the list. As you can see, some movies, like 1945 and 8 ½, are in a number format. This is the perfect opportunity to use the COUNTA function!

    On cell B19, we entered the following formula:

    =COUNTA(B4:B18) // Counts all non-empty cells in range B4:B18.
    COUNTA function to count nonblanks

    Count Cells with Numbers

    Function UsedData TypeSyntax
    COUNTSTATISTICAL=COUNT(value1, [value2,...])

    If your range contains numeric data such as numbers and dates, use the COUNT function to count the non-empty cells.

    In the following data table, I’ve calculated the total sales for November 2023.

    Data set

    I’ve skipped entering dates for off days in column A. Let’s count the total number of working days by referencing column A in the COUNT function.

    =COUNT(A:A) // Counts cells with numeric values 
    Count cells with numbers

    Subtract Blanks from the Range

    Function UsedData TypeSyntax
    COUNTBLANKSTATISTICAL=COUNTBLANK(value1, [value2, …])
    ROWSLOOKUP AND REFERENCE=ROWS(range)

    The COUNTBLANK function in Google Sheets is used to count the empty cells in a range. However, if you subtract the count of blank cells from the entire range, you can count the total number of non-empty cells.

    Take a look at this spreadsheet

    GSheets Table

    The data table in range A1:E16 contains a list of activities conducted in grade five. However, there have been days where no activity was conducted.

    We’ve been assigned to count the total number of active days. In cell B18, here’s the formula I entered:

    =ROWS(D2:D16)-COUNTBLANK(D2:D16) //Subtracts the number of blank cells from the total range.
    Subtract blank cells from total count

    Set Condition to Count Cells If Not Empty

    Function UsedData TypeSyntax
    COUNTIFSTATISTICAL=COUNTIF(range,criterion)
    COUNTIFSSTATISTICAL=COUNTIFS(criteria_range1), criterion1, [criteria_range2, ..], [criterion2, …])

    While COUNTA is a great way to count cells that are not blank, it also takes hidden characters into account. To skip through hidden characters like spaces and line breaks, set conditions using COUNTIF and COUNTIFS.

    COUNTIF and COUNTIFS are quite similar functions. The only differentiating factor between these functions is that COUNTIFS allows you to set multiple criteria.

    We’ve covered these functions entirely in another article, check it out if it piques your interest!

    The spreadsheet below holds the marksheet for 30 students.

    Marksheet in GSheets

    Students who have passed are marked with a “P.” Students who failed the assessment were graded an “F” while absentee students weren’t marked at all.

    If you look closely, however, there is a line break in the cells that appear empty. Let’s use this information to count the total number of students who appeared in the exam.

    =COUNTIF(B2:B31,"<>"&CHAR(10)) //Counts all cells except ones with linebreaks.
    COUNTIF to exclude empty cells

    Using SUMPRODUCT Function

    Function UsedData TypeSyntax
    SUMPRODUCTINTEGER=SUMPRODUCT(array1, [array2,...])
    LENINTEGER=LEN(text)
    TRIMTEXT=TRIM(text)

    You can set criteria to exclude counting cells with line breaks and spaces using COUNTIFS. However, if you’re dealing with a large data set, you will have to set multiple criteria for each of these null values.

    To disregard these null characters without setting criteria, nest the TRIM and LEN functions inside SUMPRODUCT.

    The TRIM function will first remove spaces, apostrophes, and linebreaks. Then, using the LEN function, we will determine if the characters in the cell are at least a character long.

    Finally, the SUMPRODUCT function will calculate the total number of cells that have these characters.

    Let’s calculate the total number of non-blank cells, excluding spaces, apostrophes, and linebreaks in column A.

    Google sheets table

    In cell D3, here’s the formula I entered:

    =SUMPRODUCT(LEN(TRIM(A:A))>0) //Counts all non-empty cells excluding spaces, apostrophes, and linebreaks.
    SUMPRODUCT to count non blank cells
    Asmi Dhakal

      Asmi is a content writer specializing in MS Office. She loves writing Excel-related content to assist other users to learn their way around the program. She started using Excel when she first entered the industry as a marketing intern. Soon, she realized that learning the often-overlooked spreadsheet program was no piece of cake. In her articles, she attempts to brief out complex topics to help beginner to intermediate-level Excel users. Asmi uses Excel for everything, including creating a grocery list to managing her personal finance. She’s a bit dramatic when it comes to the Flash Fill feature; so much so that could write a eulogy out of it. When she’s not working, you’ll find her learning a new recipe, or cleaning up her mess (out of the failed recipe).

      Related Posts

      Google Sheets By Jabin Manandhar

      9 Ways to Fix Google Sheets Not Working

      Google Sheets By Asmi Dhakal

      How to Delete Every Other Row in Google Sheets

      Google Sheets By Nisha Gurung

      How to Highlight Duplicates in Google Sheets

      Add A Comment
      Table of ContentsToggle Table of ContentToggle
      • Count Cells All Non-Blank Cells
      • Count Cells with Numbers
      • Subtract Blanks from the Range
      • Set Condition to Count Cells If Not Empty
      • Using SUMPRODUCT Function
      • Home
      • About Us
      • Privacy Policy
      © 2025 Inside The Web

      Type above and press Enter to search. Press Esc to cancel.