How to count cells that only contain the VALUE 0 and not the result of a formula?
41,241
Solution 1
Not sure about Excel, but VBA has this functionality. So you can define a small UDF to achieve this:
Function HasFormula(r as Range) As Boolean
HasForumla = r.HasFormula
End Function
Now you can call this function with IF and COUNT to get your results.
Solution 2
COUNTIF(A1:A7;0) this worked for me
Author by
Ana Ban
Updated on December 25, 2020Comments
-
Ana Ban over 3 years
For the following sheet:
A 1 0 2 0 as formula result 3 0 4 0 as formula result 5 0 as formula result 6 blank 7 0
How do I count only the cells with
0
entered as VALUES and not the cells with0
as their formula result, i.e.COUNTIF(A1:A7,0 AS VALUE)
= 3I've tried the following:
COUNTIF(A1:A7,0)
= 6COUNTIF(A1:A7,"0")
= 6