ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How can I use €ścountif€ť to count BOTH zeros AND blank cells as zer (https://www.excelbanter.com/excel-worksheet-functions/122027-how-can-i-use-%E2%80%9Ccountif%E2%80%9D-count-both-zeros-blank-cells-zer.html)

Danielle

How can I use €ścountif€ť to count BOTH zeros AND blank cells as zer
 
How can I use €ścountif€ť to count BOTH zeros AND blank cells as zeros?
Wondering if I am unaware of a formula that exists that is less messy than my
formula below to achieve this answer.

I was going to do this: =COUNTBLANK([range]) + COUNTIF([range], 0)

D.

JMB

How can I use €ścountif€ť to count BOTH zeros AND blank cells as zer
 
Part of the problem is blank cells can be due to being *truly* empty, or they
can be "" (such as the result of some formula)

=IF(some_condition, "Condition True", "")

If the cells are truly empty, you could try
=SUMPRODUCT(--(A1:A9=0))
which treats empty cells as 0. But you will get an incorrect result if your
"empty" cells actually have an empty string, "".

I usually use the solution you've already found.



"Danielle" wrote:

How can I use €ścountif€ť to count BOTH zeros AND blank cells as zeros?
Wondering if I am unaware of a formula that exists that is less messy than my
formula below to achieve this answer.

I was going to do this: =COUNTBLANK([range]) + COUNTIF([range], 0)

D.



All times are GMT +1. The time now is 01:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com