# Count the number of blank cells in a range, but only if the cell to the left is not blank

1. ## Count the number of blank cells in a range, but only if the cell to the left is not blank

Hi all ... First post for me, and apologies if this has been solved elsewhere here. I have looked, but don't seem to find a solution, thus my post ...

I have two columns, the first for "Serial Number" and the second for "Device Warranty", as per the attached image.

As I would like my spreadsheet to be future proof, and thus allow as many entries as time will add to it, I would like to count the number of blank cells in the "Device Warranty" column, but only count it if the cell to its left, "Serial Number" is not blank.

In other words, I would like to know how many devices I have without a warranty.

I have searched and trawled forums, bashed my head (still have the bruise) and I just can't seem to get this right ...

Any help?

Thanks!

excel.GIF

2. ## Re: Count the number of blank cells in a range, but only if the cell to the left is not b

Hi

perhaps =SUMPRODUCT(--(B1:B100=""),--(A1:A100<>""))

3. ## Re: Count the number of blank cells in a range, but only if the cell to the left is not b

This may not be the prettiest, but I got it to work.
You create a column off the page that you will eventually hide / not be in the printable zone.
If Column A = Serial Number and Column B = Device Warranty

You do formulas for each row (example of code for Row 2): =IF(AND(A2<>0,B2=0),1,0)

So, it should give you a "1" if it meets the criteria you listed. Then just make a cell somewhere that says (If that column happened to be column C): =SUM(C:C)

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1