Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Marty
 
Posts: n/a
Default Help with a COUNTIF, Please

Hey all:

This seems like such a simple problem, but I've been staring at it for a
while and can't figure out what I'm doing wrong.

I have numbers ranging from 0 to 100 in cells I4 to I450 in a worksheet. I
want to count the cells by increments of 10. In other words, I need 10
formulas showing:
-how many numbers are greater than zero and less than or equal to 10,
-how many are greater than 10 but less than or equal to 20,
-greater than 20 but less than or equal to 30,
and so forth.

Here is the formula I put into the cell to calculate the =0 and <= 10 range:

=COUNTIF(I4:I450,AND(I4:I450=0,I4:I450<=10))

This yields a zero. I know the answer should be 168.

Can somebody please tell me what's wrong with this formula?

Thanks,
MARTY
  #2   Report Post  
Vasant Nanavati
 
Posts: n/a
Default

COUNTIF doesn't play well with AND. Try:

=SUMPRODUCT((I4:I450=0)*(I4:I450<=10))

--

Vasant

"Marty" wrote in message
...
Hey all:

This seems like such a simple problem, but I've been staring at it for a
while and can't figure out what I'm doing wrong.

I have numbers ranging from 0 to 100 in cells I4 to I450 in a worksheet.

I
want to count the cells by increments of 10. In other words, I need 10
formulas showing:
-how many numbers are greater than zero and less than or equal to 10,
-how many are greater than 10 but less than or equal to 20,
-greater than 20 but less than or equal to 30,
and so forth.

Here is the formula I put into the cell to calculate the =0 and <= 10

range:

=COUNTIF(I4:I450,AND(I4:I450=0,I4:I450<=10))

This yields a zero. I know the answer should be 168.

Can somebody please tell me what's wrong with this formula?

Thanks,
MARTY



  #3   Report Post  
KL
 
Posts: n/a
Default

Hi,

You can also try this:

=COUNTIF(I4:I450,"<=10")-COUNTIF(I4:I450,"<0")

Regards,
KL


"Marty" wrote in message
...
Hey all:

This seems like such a simple problem, but I've been staring at it for a
while and can't figure out what I'm doing wrong.

I have numbers ranging from 0 to 100 in cells I4 to I450 in a worksheet.
I
want to count the cells by increments of 10. In other words, I need 10
formulas showing:
-how many numbers are greater than zero and less than or equal to 10,
-how many are greater than 10 but less than or equal to 20,
-greater than 20 but less than or equal to 30,
and so forth.

Here is the formula I put into the cell to calculate the =0 and <= 10
range:

=COUNTIF(I4:I450,AND(I4:I450=0,I4:I450<=10))

This yields a zero. I know the answer should be 168.

Can somebody please tell me what's wrong with this formula?

Thanks,
MARTY



  #4   Report Post  
Marty
 
Posts: n/a
Default

Thanks for the response, but it didn't work. Result is 431. Looks like it
has "summed the product" instead of counting the cells.

I seem to recall someone writing about a double negative (--)somehow being
used in the SUMPRODUCT function to trick it into counting rather than
multiplying or summing.

Any other ideas?

"Vasant Nanavati" wrote:

COUNTIF doesn't play well with AND. Try:

=SUMPRODUCT((I4:I450=0)*(I4:I450<=10))

--

Vasant

"Marty" wrote in message
...
Hey all:

This seems like such a simple problem, but I've been staring at it for a
while and can't figure out what I'm doing wrong.

I have numbers ranging from 0 to 100 in cells I4 to I450 in a worksheet.

I
want to count the cells by increments of 10. In other words, I need 10
formulas showing:
-how many numbers are greater than zero and less than or equal to 10,
-how many are greater than 10 but less than or equal to 20,
-greater than 20 but less than or equal to 30,
and so forth.

Here is the formula I put into the cell to calculate the =0 and <= 10

range:

=COUNTIF(I4:I450,AND(I4:I450=0,I4:I450<=10))

This yields a zero. I know the answer should be 168.

Can somebody please tell me what's wrong with this formula?

Thanks,
MARTY




  #5   Report Post  
KL
 
Posts: n/a
Default

Nope, it just counts empty cells as 0-values. Try this:

=SUMPRODUCT((I4:I450=0)*(I4:I450<=10)*(I4:I450<" "))

KL

"Marty" wrote in message
...
Thanks for the response, but it didn't work. Result is 431. Looks like
it
has "summed the product" instead of counting the cells.

I seem to recall someone writing about a double negative (--)somehow being
used in the SUMPRODUCT function to trick it into counting rather than
multiplying or summing.

Any other ideas?

"Vasant Nanavati" wrote:

COUNTIF doesn't play well with AND. Try:

=SUMPRODUCT((I4:I450=0)*(I4:I450<=10))

--

Vasant

"Marty" wrote in message
...
Hey all:

This seems like such a simple problem, but I've been staring at it for
a
while and can't figure out what I'm doing wrong.

I have numbers ranging from 0 to 100 in cells I4 to I450 in a
worksheet.

I
want to count the cells by increments of 10. In other words, I need 10
formulas showing:
-how many numbers are greater than zero and less than or equal to 10,
-how many are greater than 10 but less than or equal to 20,
-greater than 20 but less than or equal to 30,
and so forth.

Here is the formula I put into the cell to calculate the =0 and <= 10

range:

=COUNTIF(I4:I450,AND(I4:I450=0,I4:I450<=10))

This yields a zero. I know the answer should be 168.

Can somebody please tell me what's wrong with this formula?

Thanks,
MARTY








  #6   Report Post  
Vasant Nanavati
 
Posts: n/a
Default

I think it should work without the third criterion, since the first one
(=0) would ignore blank cells. Didn't test it, though. as it seemed
straightforward enough.

--

Vasant


"KL" wrote in message
...
Nope, it just counts empty cells as 0-values. Try this:

=SUMPRODUCT((I4:I450=0)*(I4:I450<=10)*(I4:I450<" "))

KL

"Marty" wrote in message
...
Thanks for the response, but it didn't work. Result is 431. Looks like
it
has "summed the product" instead of counting the cells.

I seem to recall someone writing about a double negative (--)somehow

being
used in the SUMPRODUCT function to trick it into counting rather than
multiplying or summing.

Any other ideas?

"Vasant Nanavati" wrote:

COUNTIF doesn't play well with AND. Try:

=SUMPRODUCT((I4:I450=0)*(I4:I450<=10))

--

Vasant

"Marty" wrote in message
...
Hey all:

This seems like such a simple problem, but I've been staring at it

for
a
while and can't figure out what I'm doing wrong.

I have numbers ranging from 0 to 100 in cells I4 to I450 in a
worksheet.
I
want to count the cells by increments of 10. In other words, I need

10
formulas showing:
-how many numbers are greater than zero and less than or equal to 10,
-how many are greater than 10 but less than or equal to 20,
-greater than 20 but less than or equal to 30,
and so forth.

Here is the formula I put into the cell to calculate the =0 and <=

10
range:

=COUNTIF(I4:I450,AND(I4:I450=0,I4:I450<=10))

This yields a zero. I know the answer should be 168.

Can somebody please tell me what's wrong with this formula?

Thanks,
MARTY







  #7   Report Post  
Marty
 
Posts: n/a
Default

BRILLIANT!

This worked like a charm. I had to add a third term to the other nine
equations, but it worked. Thanks very much.



"KL" wrote:

Hi,

You can also try this:

=COUNTIF(I4:I450,"<=10")-COUNTIF(I4:I450,"<0")

Regards,
KL


"Marty" wrote in message
...
Hey all:

This seems like such a simple problem, but I've been staring at it for a
while and can't figure out what I'm doing wrong.

I have numbers ranging from 0 to 100 in cells I4 to I450 in a worksheet.
I
want to count the cells by increments of 10. In other words, I need 10
formulas showing:
-how many numbers are greater than zero and less than or equal to 10,
-how many are greater than 10 but less than or equal to 20,
-greater than 20 but less than or equal to 30,
and so forth.

Here is the formula I put into the cell to calculate the =0 and <= 10
range:

=COUNTIF(I4:I450,AND(I4:I450=0,I4:I450<=10))

This yields a zero. I know the answer should be 168.

Can somebody please tell me what's wrong with this formula?

Thanks,
MARTY




  #8   Report Post  
KL
 
Posts: n/a
Default

Hi again,

As far as I know -- has nothing to do with summing or counting. In
SUMPRODUCT conditional counts or summs it is just used to coerce the logical
values TRUE and FALSE into their numerical equivalents 1 and 0. It is
usually necessary when there is only one condition and no mathematical
operations, for example:

=SUMPRODUCT((I4:I450=0)*(I4:I450<=10))
-- not necessary as multiplication operator * coerces the logical values in
the matrices resulting from the equation to 1 or 0

=SUMPRODUCT(--(I4:I450<=10))
-- necessary

Regards,
KL

"Marty" wrote in message
...
Thanks for the response, but it didn't work. Result is 431. Looks like
it
has "summed the product" instead of counting the cells.

I seem to recall someone writing about a double negative (--)somehow being
used in the SUMPRODUCT function to trick it into counting rather than
multiplying or summing.

Any other ideas?

"Vasant Nanavati" wrote:

COUNTIF doesn't play well with AND. Try:

=SUMPRODUCT((I4:I450=0)*(I4:I450<=10))

--

Vasant

"Marty" wrote in message
...
Hey all:

This seems like such a simple problem, but I've been staring at it for
a
while and can't figure out what I'm doing wrong.

I have numbers ranging from 0 to 100 in cells I4 to I450 in a
worksheet.

I
want to count the cells by increments of 10. In other words, I need 10
formulas showing:
-how many numbers are greater than zero and less than or equal to 10,
-how many are greater than 10 but less than or equal to 20,
-greater than 20 but less than or equal to 30,
and so forth.

Here is the formula I put into the cell to calculate the =0 and <= 10

range:

=COUNTIF(I4:I450,AND(I4:I450=0,I4:I450<=10))

This yields a zero. I know the answer should be 168.

Can somebody please tell me what's wrong with this formula?

Thanks,
MARTY






  #9   Report Post  
KL
 
Posts: n/a
Default

Well, I did test it and it counts 'em all :-)

KL

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
I think it should work without the third criterion, since the first one
(=0) would ignore blank cells. Didn't test it, though. as it seemed
straightforward enough.

--

Vasant


"KL" wrote in message
...
Nope, it just counts empty cells as 0-values. Try this:

=SUMPRODUCT((I4:I450=0)*(I4:I450<=10)*(I4:I450<" "))

KL

"Marty" wrote in message
...
Thanks for the response, but it didn't work. Result is 431. Looks
like
it
has "summed the product" instead of counting the cells.

I seem to recall someone writing about a double negative (--)somehow

being
used in the SUMPRODUCT function to trick it into counting rather than
multiplying or summing.

Any other ideas?

"Vasant Nanavati" wrote:

COUNTIF doesn't play well with AND. Try:

=SUMPRODUCT((I4:I450=0)*(I4:I450<=10))

--

Vasant

"Marty" wrote in message
...
Hey all:

This seems like such a simple problem, but I've been staring at it

for
a
while and can't figure out what I'm doing wrong.

I have numbers ranging from 0 to 100 in cells I4 to I450 in a
worksheet.
I
want to count the cells by increments of 10. In other words, I need

10
formulas showing:
-how many numbers are greater than zero and less than or equal to
10,
-how many are greater than 10 but less than or equal to 20,
-greater than 20 but less than or equal to 30,
and so forth.

Here is the formula I put into the cell to calculate the =0 and <=

10
range:

=COUNTIF(I4:I450,AND(I4:I450=0,I4:I450<=10))

This yields a zero. I know the answer should be 168.

Can somebody please tell me what's wrong with this formula?

Thanks,
MARTY









  #12   Report Post  
KL
 
Posts: n/a
Default

My only doubt is what if the OP wants to count both 0 values and 0-10, but
not empty cells?

KL

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Good point; missed that! :-)

--

Vasant

"Don Guillett" wrote in message
...
try changing =0 to 0

--
Don Guillett
SalesAid Software

"Marty" wrote in message
...
Thanks for the response, but it didn't work. Result is 431. Looks
like

it
has "summed the product" instead of counting the cells.

I seem to recall someone writing about a double negative (--)somehow

being
used in the SUMPRODUCT function to trick it into counting rather than
multiplying or summing.

Any other ideas?

"Vasant Nanavati" wrote:

COUNTIF doesn't play well with AND. Try:

=SUMPRODUCT((I4:I450=0)*(I4:I450<=10))

--

Vasant

"Marty" wrote in message
...
Hey all:

This seems like such a simple problem, but I've been staring at it

for
a
while and can't figure out what I'm doing wrong.

I have numbers ranging from 0 to 100 in cells I4 to I450 in a

worksheet.
I
want to count the cells by increments of 10. In other words, I
need

10
formulas showing:
-how many numbers are greater than zero and less than or equal to

10,
-how many are greater than 10 but less than or equal to 20,
-greater than 20 but less than or equal to 30,
and so forth.

Here is the formula I put into the cell to calculate the =0 and <=

10
range:

=COUNTIF(I4:I450,AND(I4:I450=0,I4:I450<=10))

This yields a zero. I know the answer should be 168.

Can somebody please tell me what's wrong with this formula?

Thanks,
MARTY









  #13   Report Post  
Vasant Nanavati
 
Posts: n/a
Default

Oh, you are absolutely correct. I meant that I missed the fact that it was
=0 and not 0. Your solution was the best.


--

Vasant



"KL" wrote in message
...
My only doubt is what if the OP wants to count both 0 values and 0-10, but
not empty cells?

KL

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Good point; missed that! :-)

--

Vasant

"Don Guillett" wrote in message
...
try changing =0 to 0

--
Don Guillett
SalesAid Software

"Marty" wrote in message
...
Thanks for the response, but it didn't work. Result is 431. Looks
like
it
has "summed the product" instead of counting the cells.

I seem to recall someone writing about a double negative (--)somehow

being
used in the SUMPRODUCT function to trick it into counting rather than
multiplying or summing.

Any other ideas?

"Vasant Nanavati" wrote:

COUNTIF doesn't play well with AND. Try:

=SUMPRODUCT((I4:I450=0)*(I4:I450<=10))

--

Vasant

"Marty" wrote in message
...
Hey all:

This seems like such a simple problem, but I've been staring at

it
for
a
while and can't figure out what I'm doing wrong.

I have numbers ranging from 0 to 100 in cells I4 to I450 in a
worksheet.
I
want to count the cells by increments of 10. In other words, I
need
10
formulas showing:
-how many numbers are greater than zero and less than or equal to

10,
-how many are greater than 10 but less than or equal to 20,
-greater than 20 but less than or equal to 30,
and so forth.

Here is the formula I put into the cell to calculate the =0 and

<=
10
range:

=COUNTIF(I4:I450,AND(I4:I450=0,I4:I450<=10))

This yields a zero. I know the answer should be 168.

Can somebody please tell me what's wrong with this formula?

Thanks,
MARTY











  #14   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Sun, 22 May 2005 14:30:03 -0700, "Marty"
wrote:

Hey all:

This seems like such a simple problem, but I've been staring at it for a
while and can't figure out what I'm doing wrong.

I have numbers ranging from 0 to 100 in cells I4 to I450 in a worksheet. I
want to count the cells by increments of 10. In other words, I need 10
formulas showing:
-how many numbers are greater than zero and less than or equal to 10,
-how many are greater than 10 but less than or equal to 20,
-greater than 20 but less than or equal to 30,
and so forth.

Here is the formula I put into the cell to calculate the =0 and <= 10 range:

=COUNTIF(I4:I450,AND(I4:I450=0,I4:I450<=10))

This yields a zero. I know the answer should be 168.

Can somebody please tell me what's wrong with this formula?

Thanks,
MARTY


You could also use the FREQUENCY worksheet function.

Select 10 cells.
Click in the formula bar.
Enter the following formula into the bar.

=FREQUENCY($I$4:$I$450,{10,20,30,40,50,60,70,80,90 ,100})

Then, instead of hitting <enter, hold down <ctrl<shift while hitting
<enter.

This will be entered as an array formula and you will have the output you are
looking for.


--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
COUNTIF COMBINATION?? Heather Excel Worksheet Functions 1 April 26th 05 02:44 AM
Combining IF and COUNTIF based on two columns maxtrixx Excel Discussion (Misc queries) 5 March 31st 05 06:21 PM
COUNTIF in one colum then COUNTIF in another...??? JonnieP Excel Worksheet Functions 3 February 22nd 05 02:55 PM
Countif - Countif maswinney Excel Worksheet Functions 3 November 15th 04 11:06 PM
countif, again Liz G Excel Worksheet Functions 2 November 1st 04 11:20 PM


All times are GMT +1. The time now is 08:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"