counting cells with a criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

Please can anyone help.

I need to count a group of cells that are spread through the spreadsheet
which meet a criteria range e.g

count the number of cells for X2, BX2, CX2 that are greater than or equal to
40 but less than or equal to 49.

I cant seem to use COUNTIF. Presumably because it needs a range e.g. X2:CX2
and I do not not want to count all cells in the range, just specific cells.

Many thaks for any help.

Nick
 
Hello Nick:
If its just three cells try
=AND(X2>=40,X2<=49)+AND(BX2>=40,BX2<=49)+AND(CX2>=40,CX2<=49)
best wishes
 
If you have only three cells, you can just use a formula. It also helps to know
that Excel treats TRUE as 1, and FALSE as 0. So your formula would be:

=and(X2>=40,x2<=49)+and(bx2>=40,bx2<=49)+and(cx2>=40,cx2<=49)
 
Hi fred

Thanks to both of you fro solving this.

Fred Smith said:
If you have only three cells, you can just use a formula. It also helps to know
that Excel treats TRUE as 1, and FALSE as 0. So your formula would be:

=and(X2>=40,x2<=49)+and(bx2>=40,bx2<=49)+and(cx2>=40,cx2<=49)
 
Maybe shorter

=SUMPRODUCT(COUNTIF(INDIRECT({"X2","BX2","CX2"}),">=40"))
-SUMPRODUCT(COUNTIF(INDIRECT({"X2","BX2","CX2"}),">=50"))

extend as required

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 

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

Back
Top