CountIf Q

S

Sean

Can the formula below work, I get a #Value! returned so I assume I
have a syntax wrong. Tried entering as an Array, but still the same. I
know =COUNTIF(C12:C14,"Yes") works but I want to skip C13

=COUNTIF((C12,C14),"Yes")
 
R

Ron Rosenfeld

Can the formula below work, I get a #Value! returned so I assume I
have a syntax wrong. Tried entering as an Array, but still the same. I
know =COUNTIF(C12:C14,"Yes") works but I want to skip C13

=COUNTIF((C12,C14),"Yes")

=(C12="Yes")+(C14="yes")


--ron
 
R

Ron Rosenfeld

Thanks Ron, knew it was simple

You're welcome. Seems COUNTIF won't take a non-contiguous range as an
argument. So you could do several COUNTIF's, but it seems simpler to just add
the equalities as Excel will automagically convert those to a 1 or 0 depending
on the result being TRUE or FALSE.

If you had several multi-cell discontiguous ranges, (as opposed to just two
cells), then serial COUNTIF's might be more efficient. eg:

=COUNTIF(A1:A10,"YES") + COUNTIF(C8:D10,"YES")


--ron
 
B

Bob Phillips

It can be 'persuaded'

=SUMPRODUCT(--COUNTIF(INDIRECT({"C12","C14"}),"Yes"))

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top