CountIF Formula help

demodren

Board Regular
Joined
Aug 20, 2010
Messages
106
Hi all, I am looking for some basic help on some count formulas.. any help would be much appreciated..Thanks so much

I am using:
Code:
=COUNTIF(W17:W1500,"<>0")

I am trying to do couple of things:
1) Count number of rows with values <> 0
it seems it counts rows that are blank as a value as well. Is there a way to avoid it? I am specifically looking for it to give me a count of how many cells do not have the value 0. (W17:W1500 is just a range, my total rows are only 1000, I think its scanning all 1500 rows and adding count to blank cells)

2) Count number of rows with values <-1 OR >1
=COUNTIF(W17:W1500,">1") OR =COUNTIF(W17:W1500,"-<1")
is there a way to combine these?

Thanks so much
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
There are a myriad of different ways, but here is one (and it is really using the same logic for both of your questions):

1. =COUNTIF(W17:W1500,">0")+COUNTIF(W17:W1500,"<0")

2. =COUNTIF(W17:W1500,">1")+COUNTIF(W17:W1500,"<-1")
 
Upvote 0
thanks Joe, that did the trick!

Is there a way also summing the values in those cells? based on the same characterstics, instead counting just tell the sums?

thanks so much
 
Upvote 0
Is there a way also summing the values in those cells? based on the same characterstics, instead counting just tell the sums?
I'll give you one guess what function name would be
**cue Jeopardy! music here**
...
...

If you said, SUMIF, you are a winner!;)
(just having a little fun on a Friday afternoon!)
 
Upvote 0
sorry please disregard the previous post. There are 2 other steps that I am trying to complete and curiosu if there a way to perform this.

1) Based on the rows in column W where cells <> 0, sum up all the values in column Z for those cells.. Basically my column W tells me how many units I have missing of the product and column Z tells me monetary impact.

2) insteaf of counting # of cells, sum those values for below formula
Code:
 =COUNTIF(W17:W1500,">1")+COUNTIF(W17:W1500,"<-1")


Sorry I should of been more clearier on the whole picture.. Any help is much appreciated Thanks so much
 
Upvote 0
duh, ok so step 2 is all good. SUMIF works! for some reason i was using SUMPRODUCT.....my mistake
 
Upvote 0
You could use SUMPRODUCT too, but it is more complex and not necessary in this case.
 
Upvote 0
I was getting ahead of myself :) what about the 1) as here I want to sum the cells from column based on results from other column.. would it be COUNTIF combined with SUMIF?

Code:
=COUNTIF(W17:W1500,">0")+COUNTIF(W17:W1500,"<0")

"Count number of rows with values <> 0
it seems it counts rows that are blank as a value as well. Is there a way to avoid it? I am specifically looking for it to give me a count of how many cells do not have the value 0. (W17:W1500 is just a range, my total rows are only 1000, I think its scanning all 1500 rows and adding count to blank cells)"
 
Upvote 0
sorry please disregard the previous post. There are 2 other steps that I am trying to complete and curiosu if there a way to perform this.

1) Based on the rows in column W where cells <> 0, sum up all the values in column Z for those cells.. Basically my column W tells me how many units I have missing of the product and column Z tells me monetary impact.

2) insteaf of counting # of cells, sum those values for below formula
Code:
 =COUNTIF(W17:W1500,">1")+COUNTIF(W17:W1500,"<-1")


Sorry I should of been more clearier on the whole picture.. Any help is much appreciated Thanks so much
For #1...

Book1
WZAAAB
21147_204
3_69__
4255__
5024__
61019__
7050__
8016__
96539__
10-1025__
Sheet1

This formula entered in AB2:

=SUMIF(W2:W10,"<>0",Z2:Z10)

Note that this will evaluate empty cells as being <>0 and will sum any values that correspond to the empty cells as in this case with Z3 being included in the sum.

Not sure what you want to do with #2. Can you explain that in words?
 
Upvote 0
thats perfect! even better if its picks upblank ones.. thanks so much.. I am good on all the points.. sorry for some confusion :)
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,183
Members
452,893
Latest member
denay

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top