Solved

COUNTIF with blank and notblank

Posted on 2011-02-27
5
432 Views
Last Modified: 2012-05-11
I have a spreadsheet with a column that has text. Some cells are blank.

I have these two formula's to count:
=COUNTIF($K:$K, "0")
=COUNTIF($K:$K, "1")

A blank cell should be counted as zero, but is not for some reason. Actually, I can not have  all the blank cells counted as I am looking at the whole column. Need to stop looking for blanks when column I has its first blank cell.

To the main question...why aren't blank cells being counted?
and...
Does the "1" suffice to count a non-blank cell?

Thanks for any assistance

0
Comment
Question by:dgd1212
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 34994211
The problem is that there is no way to distinguish between a blank cell in your data rows versus a blank row below your data rows.

The only way to solve the problem is to reference only the range of cells representing your data rows. Or put zeros into the blank cells you do want to count.

Is there another column that does not contain any blank cells in the table? If so we can use that to do the calculation.

Kevin
0
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 500 total points
ID: 34994219
Assuming column A does not contain any blank cells then use:

=COUNTIF($K:$K, "0")+COUNTBLANK($K:$K)-COUNTBLANK($A:$A)

Kevin
0
 
LVL 20

Expert Comment

by:Ardhendu Sarangi
ID: 34994222
if you can post a sample spreadsheet, maybe there can be an alternative to what you are looking for...
0
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 34994229
>Does the "1" suffice to count a non-blank cell?

If you mean will blank cells not be counted, then yes.

Kevin
0
 

Author Closing Comment

by:dgd1212
ID: 34994291
Thank You!!!! The formula worked perfect.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
EXCEL file checking. 11 47
A WS within a WS 11 38
autofill formulas using macro 8 48
what is the 64bit version of this window API? 2 23
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question