Hi I have an average function:
=IF(ISERROR(AVERAGE(H6:H31)), "", AVERAGE(H6:H31))
but it returns the wrong average for the numbers: 0, 0, 3, 0, 0, 0, 0, 0, 4, 0
It produces 0.7 instead of 3.5 and I am definitely using column H row 6 to 31
What could cause this? Thanks
0.7 is the correct answer. See here
You are looking for the average excluding zeros. In which case you should use the AVERAGEIF function. In your case that would be:
=AVERAGEIF(H6:H31,"<>0")
This will give you 3.5
Average is considered as
Grand Total / Total no of Obs.
In this case you have total of 10 observations.
so, 7/10 is 0.7
as said above. Excel is correct. This should get you what you want though:
=SUMIF(H6:H31, "<>0")/COUNTIF(H6:H31, "<>0")
Related
I have a set of weights in rows BA40:BZ40 and I want each row starting from BA60:BZ60 to sum (BA40*BA60 + BB40*BB60 + ... + BZ40*BZ60). Then paste this in CA60 then move onto row 61. However I still need to reference BA40:BZ40. I don't know if its my simplistic mind getting confused or its not possible. However I have learnt everything is possible. My code at the moment is
Dim cellsum As Long
For i = 60 to 1000
So I want to calculate for each day, the weighted sum of the loss. For example day 1, sum(0.2*(-10)+ 0.2*(-8)+ 0.1*(-6) + 0.5(-4))
Weight: 20%, 20%, 10%, 50%
Day 1: -10, -8, -6, -5
Day 2: -9, -8, -7, -6
Day 3: -5, -5, -4, -4
...
Use SUMPRODUCT() function as following. It will automatically calculate percentage. You do not need to sum as .2, .1
=SUMPRODUCT(BA40:BZ40,BA60:BZ60)
Imagine the follwing table:
Then the weighted sum of day 1 would calculate according to your example like …
=SUM($B$1*B3,$C$1*C3,$D$1*D3,$E$1*E3)
which is the same as …
=SUMPRODUCT($B$1:$E$1,B3:E3)
This formula in G3 then can easily pulled/copied down until G5.
So for your data it should be something like the following in cell CA60 …
=SUMPRODUCT($BA$40:$BZ$40,BA60:BZ60)
and then copy down to the other rows.
I have 4 numbers I need to add up from a database example (12, 0, 0, 3) I need to know the average of these numbers ignoring the 0s as in 12 + 3 /2 = 15 Ave 7.5. I cannot find a way of avoiding the 0s which makes the answer 12 + 3 /4 = 3.75.
Thanks For Any Help
Try
=AVERAGEIF(A1:A3,">0",A1:A3)
works with your numbers... 12 in A1, 0 in A2, 3 in A3.
I have the following little table. I'd like a formula that finds the number of values where the cumulative total (of column B) is less than some threshold (tx).
I tried
{=MIN((SUM(OFFSET(B1,0,0,A1:A17))>tx)*A1:A17)-1}
but OFFSET doesn't seem to be arrayable like that. Obviously, this would be trivial with a helper column, but for certain reasons that is not possible.
So the correct answer here should be 10.
tx = .8
A B
1 0.112106465
2 0.110981698
3 0.091959216
4 0.082163441
5 0.073292066
6 0.072407529
7 0.071646289
8 0.061646797
9 0.06011448
10 0.057566381
11 0.050341978
12 0.048227061
13 0.043207335
14 0.03940462
15 0.012914194
16 0.007603446
17 0.004417003
You're not really looking for a MIN; rather it should be MAX that follows your condition.
In E7 as a standard (non-array) formula,
=AGGREGATE(14, 6, ROW(1:17)/(SUBTOTAL(9, OFFSET(B1, 0, 0, ROW(1:17), 1))<D7), 1)
I prefer the following array formula** due to its non-volatility:
=MATCH(TRUE,MMULT(0+(ROW(B1:B17)>=TRANSPOSE(ROW(B1:B17))),B1:B17)>=0.8,0)-1
Regards
The most succinct way to do it I've found is
=SUM(--(SUBTOTAL(9,OFFSET(B1,,,A1:A17))<0.8))
entered as an array formula, or, equivalently,
=SUMPRODUCT(--(SUBTOTAL(9,OFFSET(B1,,,A1:A17))<0.8))
In Excel, it is possible to select a random value from a set of 5 options in the following manner:
Values
e.g. 15, 30, 50, 75, or 100
Formula
=CHOOSE(RANDBETWEEN(1,5),15,30,50,75,100)
If I wanted to select a value from a much denser range how would I do it?
e.g. 0.00, 0.01, 0.02, 0.03 ,0.04 ,0.05 ... 19.95, 19.96, 19.97, 19.98, 20.00
What would be the correct formulae?
Consider the following formula:
=0.01*RANDBETWEEN(0,2000)
This will produce random multiples of .01
Scale the output of the random function by multiplying/dividing it by a constant.
For instance, if your Random function outputs floating decimal values between 0 and 1, and you need outputs between 0 and 100, multiply the output of the random function by 100.
If you need the final result to be an integer, you can then round the value to the nearest integer.
It sounds like you want
=ROUND(RAND()*20,2)
The 20 is the maximum value of your zero-to-maximum range, and the 2 is how many decimal places it'll round the final output to.
Suppose I conduct a survey of 10 people asking whether to rank a movie as 0 to 4 stars. Allowable answers are 0, 1, 2, 3, and 4.
The mean is 2.0 stars.
How do I calculate the certainty (or uncertainty) about this 2.0 star rating? Ideally, I would like a number between 0 and 1, where 0 represents complete uncertainty and 1 represents complete certainty.
It seems clear that the case where the 10 people choose ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ) would be the most certain, while the case where the 10 people choose ( 0, 0, 0, 0, 0, 4, 4, 4, 4, 4 ) would be the least certain. ( 0, 1, 1, 2, 2, 2, 2, 3, 3, 4 ) would be somewhere in the middle.
The standard deviation does not have the properties requested. It is zero when everyone chooses the same answer, and can be as great as sqrt(40/9) = 2.11 when there are five 0s and five 4s.
I suggest you use 1-stdev(x)/sqrt(40/9) which will take value 1 when everyone agrees, and value 0 when there are five 0s and five 4s.
The function you're after here is the standard deviation.
The standard deviations of your three examples are 0 (meaning no deviation), 2.1 (large deviation) and 1.15 (in between).
What you want is called the standard deviation.
You should consider whether or not the mean value is an appropriate statistic for this kind of information. ie Is a movie rated 2 stars twice as good as one rated 4 stars?
You may be better served by using a percentile measure (such as the median) to represent the central tendency, and a percentile range (such as the IQR) to measure 'certainty'. As in the answers above, certainty would be greatest with a value of 0, as you are really making a measurement of deviation from the central tendency.
Incidentally, a survey of 10 people is too small to perform much in the way of meaningful statistical analysis.