Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to count cells that only contain the VALUE 0 and not the result of a formula?

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 with 0 as their formula result, i.e.

COUNTIF(A1:A7,0 AS VALUE) = 3

I've tried the following:

COUNTIF(A1:A7,0) = 6

COUNTIF(A1:A7,"0") = 6

like image 945
Ana Ban Avatar asked Dec 21 '22 06:12

Ana Ban


2 Answers

COUNTIF(A1:A7;0) this worked for me

like image 135
pata Avatar answered Dec 28 '22 08:12

pata


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.

like image 23
dotNET Avatar answered Dec 28 '22 09:12

dotNET