How to Exclude 0 values from my =Count formula? - excel

DESPERATE for any help :-)
I need to exclude 0 values from my =COUNT excel formula in order to get an automated frequency value feeding another formula in my model.
Actual Base Formula:
=COUNT(J10,J11,J12,N10,N11,N12,J14,J15,J16,N14,N15,N16)
I am trying to get the formula to NOT count when any of these cells have O values. For instance, if J10 is greater than 0, include it in the count.
I have tried several different "IF" statements, but am failing miserably!
I basically need to dummy proof this by automating it versus having users simply count the cells with values and enter the number into the frequency field for my score calculator. Thanks so much for any help!!

Since your range is disjointed the best method is four(4) countifs:
=COUNTIF(J10:J12,">0")+COUNTIF(N10:N12,">0")+COUNTIF(J14:J16,">0")+COUNTIF(N14:N16,">0")

Fixed based on the comments.
=COUNTIF(J10:J12,">0")+COUNTIF(N10:N12,">0")+COUNTIF(J14:J16,">0")+COUNTIF(N14:N16,">0")

Related

Using vlookup and count in the same formula

I am having difficulties combining Vlookup value with count.
As you can see here, CPR is a unique code for every employee and next to it is the type of mistakes that specific employee did.
In this sheet, i want to count the number of mistakes done by that specific employee from the first sheet which mean the code should only count the cells that only contain value.
Thank you.
You can use following formula:
=SUMPRODUCT(($A$1:$A$10=E2)*NOT(ISBLANK($B$1:$B$10)))
I think you want to use Excel's countif function. I don't think vlookup is helpful here.
For example, if you write =countif(G4:G999, 8345) it will count how many times the number 8345 occurs in that range of cells.
You could use:
=COUNTIF(Jan!G:G,Sheet13!D1)
The above formula count how many times the value in Sheet13!D1 appears in Jan!G:G

Ranking formula in excel based on two columns

I'm trying to rank the following items based on price using the following formula =SUMPRODUCT(([Item]=[#Item])*([#Price]<[Price]))+1, but it isn't returning any results:
When I use the same formula in the following test table it works, =SUMPRODUCT(($A$2:$A$7=A2)*(B2<$B$2:$B$7))+1:
Can someone please let me know what I am doing wrong? Thanks
EDIT 2 : Evaluation https://imgur.com/a/eXIYPAP
Your formula works fine for me.
Are you sure that A2 and A3 are the same value? There may be some hidden white space causing problems. Just try
=A2=A3
in another cell to make sure they are the same.
USE COUNTIFS INSTEAD
I don't know why your formula isn't working, however, I would suggest avoiding SUMPRODUCT where you can.
=COUNTIFS([Item],[#Item],[Price],">"&[#Price])+1
This will count the number of prices higher than the current one for each item (+1, if you want the rank to start at 1 instead of 0)
If your goal is to get the ranking for each unique item, =SUMPRODUCT(([Item]=[#Item])*([Price]>[#Price]))+1 should do the trick. If the goal is to get the ranking based only on price, don't have it figured out yet.

SUMPRODUCT with Dates for Criteria

I am trying to obtain an average of an array of fields with the following simple formula
=SUMPRODUCT(Main!BA:BA, Main!CY:CY, --(Main!D:D >=D3, Main!D:D <=E3))
I'm getting a #DIV/0! error. I have no clue why it's dividing anything. Please help!
Basically, how can I get the sum product of columns D vs E between the dates 11/05 to 11/27.
You need to use * or + depending on whether you want AND or OR.
=SUMPRODUCT(Main!BA:BA, Main!CY:CY, (Main!D:D >=D3)*(Main!D:D <=E3))
One more note:
You want to limit the references to only that with data as this formula will do a lot of unneeded calculations.
From looking at your worksheet, you want this:
=SUMPRODUCT(D:D*E:E*(C:C>=$C$27)*(C:C<=$C$49))

Taking average of certain values in one Excel column based on values in another

I have a (large) array of data in Excel of which I need to compute the average value of certain values in one column, based on the values of another column. For example, here's a snippet of my data:
So specifically, I want to take the average of the F635 mean values corresponding with Row values of 1. To take it a step further, I want this to continue to Row values of 2, Row values of 3 etc.
I'm not familiar with how to run code in Excel but have attempted to solve this by using the following:
=IF($C = "1", AVERAGE($D:$D), "")
which (to my understanding) can be interpreted as "if the values (anywhere) in column C are equal to 1, then take the average of the corresponding values in column D."
Of course, as I try this I get a formula error from Excel.
Any guidance would be incredibly appreciated. Thanks in advance.
For more complicated cases, I would use an array-formula. This one is simple enough for the AVERAGEIF formula. For instance =AVERAGEIF(A1:A23;1;B1:B23)
Array-formula allows for more elaborate ifs. To replicate the above, you could do =SUM(IF($A$1:$A$23=1;$B$1:$B$23;0))/COUNT(IF($A$1:$A$23=1;$B$1:$B$23;0)).
Looks like more work but you can create extremely elaborate if-statements. Instead of hitting ENTER, do CTRL-ENTER when entering the formula. Use * between criteria to replicate AND or + for OR. Example: SUM(IF(($A$1:$A$23="apple")*($B$1:$B$23="green");$C$1:$C$23;0)) tallies values for green apples in c1:c23.
Your sample data includes three columns with potential ifs so my guess is that you're going to need array formulas at some point.
Excel already has a builtin function for exactly this use; AVERAGEIF().
=AVERAGEIF(C:C,1,D:D)

CountIF error with <0

I would need some help again with another excel countif expression. I have the line i2:al2 which contains leftover stock data.I am building a worksheet to calculate remaining stocks in % as per supervisor's wish.
As I am working with %, for example if I say that 90% sales that means we have 103 stock left and with 91% sales I have 100 stock left.
Anyways I got around to count the number of stock left in line i2:a12 using countifs.
Example if I need to calculate leftover stock for sales at 90% which means leftover stock level of 100 to 102. I have used :
=countif(range,">100")-countif(range,">102")
This method seems to work till I reach negative numbers, i.e. oversales. For example, if I try to do the following:
=countif(range,"-100")-countif(range,">0")
the formula seems to stop working. If I count manually using a conditional formatting I get a totally different answer for the oversales.
Maybe I am getting the logic of the countif function wrong. My purpose for the expressison is:
=count(in range, values >=X & <=Y)
As I have only access to excel 2003 I cannot use Countifs method. Anyone could help me on this issue?
Many thanks.
You can use an array formula:
=SUM((range>=x)*(range<=y))
For that to work, you need to press CTRL-SHIFT-ENTER for that to use array formula.
Alternatively, using what simoco gives in the comment works too without having to save as array formula.

Resources