View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default How to count cells which contain a formula that returns TRUE

On Wed, 12 Aug 2009 04:16:02 -0700, Art wrote:

=IF(AND(C181=1,G181=0,J181=1), "TRUE", "")
this returns TRUE or nothing.
I just want simply count the cells returning TRUE.

I've tried both formulas:
=COUNTIF (A1:A10,TRUE)
or
=COUNTIF(A1:A10,"TRUE")
Both give 0 in my case.
Thanks,


This is a fascinating finding.

One simple way around it is to change your IF formula to return the Boolean:

=IF(AND(C181=1,G181=0,J181=1), TRUE, "")

COUNTIF will then work as designed.

I think what may be happening is that COUNTIF is changing what should be the
text string "TRUE" into the Boolean, because both of these formulas seem to
work, so long as you change your IF formula to return a BOOLEAN TRUE:

=COUNTIF(A1:A10,"TRUE")
=COUNTIF(A1:A10,TRUE)

--ron