Count Blank Cells Row by Row in Google Sheets (COUNTBLANK Each Row)

Are you tired of trying to count blank cells in Google Sheets row by row, only to find that the COUNTBLANK function doesn’t quite live up to your expectations? Well, fear not, because I’m here to share a little secret with you that will make counting blank cells a breeze!

The Limitations of COUNTBLANK

You see, the COUNTBLANK function in Google Sheets is great for counting empty cells in a range. However, it falls short when it comes to counting blank cells row by row. That’s because COUNTBLANK doesn’t autofill in each row, making it impossible to use as an array formula for this purpose.

A Clever Alternative Solution

But don’t worry, I’ve got a workaround for you! By using the MMULT function in Google Sheets, we can create an array formula that counts blank cells row by row. Let me show you how it’s done.

Step 1: Set Up Your Data

Before we dive into the formula, let’s set up some sample data. Take a look at this image:

Count Blank Cells Row by Row - Array Formula

In this example, we have a table with several rows. Our goal is to count the number of blank cells in each row.

Step 2: Crafting the Formula

Now, let’s get to the exciting part – the formula! Here’s the array formula that will count blank cells row by row:

H2: =ArrayFormula(mmult(if(B2:F14="",1,0),transpose(column(B2:F2)^0)))

This formula uses the MMULT function to calculate the matrix product of two matrices. The first matrix, if(B2:F14="",1,0), checks if each cell in the range is blank and assigns a value of 1 if it is. The second matrix, transpose(column(B2:F2)^0), generates a column of ones. The MMULT function then performs the calculation, resulting in the count of blank cells row by row.

Step 3: Handling Blank Rows

But wait, there’s more! If you prefer not to include rows that are completely blank in the count, we can tweak the formula a bit. Here’s the modified formula for this scenario:

I2: =ArrayFormula(if(len(trim(transpose(query(transpose(B2:F14),,9^9)))),mmult(if(B2:F14="",1,0),transpose(column(B2:F2)^0)),))

In this formula, we’ve added an additional layer of logic using the IF function to test whether each row is blank or not. If a row contains at least one non-blank cell, the count of blank cells for that row is calculated using the same MMULT function. Otherwise, the cell is left blank.

Conclusion

And there you have it – a simple yet powerful array formula that can count blank cells row by row in Google Sheets. Say goodbye to manual counting and let the formula do the work for you!

If you want to learn more about advanced functions and techniques in Google Sheets, be sure to visit Crawlan.com for more juicy secrets!

Resources:

  1. How to Count Until a Blank Row in Google Sheets
  2. How to Count If Not Blank in Google Sheets [Tips and Tricks]
  3. Not Blank as a Condition in Countifs in Google Sheets
  4. Count From First Non-Blank Cell to Last Non-Blank Cell in a Row in Google Sheets
  5. Count Words and Insert Equivalent Blank Rows in Google Sheets
  6. Also, check the tag row-wise array below

Related posts