How to define range of values in a formula?

Y

yasen

A B C D E
674 817 2 0 1
-6.0
-6.0
0.1


I need to count only the cells (in the first column) wich contain values
within a specified range and display the result (if <0.5 in column C, if
between -0.5 and 0.5 in column D and if >0.5 in column E). I used the COUNTIF
function. It works well with the simple range definitions "<-0.5" and ">0.5".
How should I define the range between -0.5 and 0.5? I tried this below, but
it seems I am wrong somewhere.
=COUNTIF(A30:A32;"AND(-0.5>,<0.5)").

Thank you in advance!
 
R

Roger Govier

Hi

You can't use the AND function inside Countif.
Instead, take one value from another

=COUNTIF(range,"<="&0.5)-COUNTIF(range,"<"&-0.5)
 
M

Max

Use 2 countifs, something like this:
=COUNTIF(A1:A4,">-0.5")-COUNTIF(A1:A4,">=0.5")

Adapt the range (and the separator?) to suit,
maybe for your example posted it'll be:
=COUNTIF(A30:A32;">-0.5")-COUNTIF(A30:A32;">=0.5")
 

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