#1
|
|||
|
|||
Average function not averaging
When I use =average on a column of numbers I'm getting the wrong result. By using sum and then dividing the number of cells i get an entirely different answer. Excel says 5.49. I say 10.64. I know mine to be right because when I do a standard deviation from the mean I get results that make sense. The other number simply doesn't work. So where is excel getting it?
|
#2
|
|||
|
|||
Post the sheet please.
|
#3
|
|||
|
|||
I figured out the problem. I have hidden rows that are being used in the calculation. I understand that the averageif function will use only the visible rows. I've looked at several sites trying to understand how to set up the three arguments to use averageif, but I'm not quite getting it.
|
#4
|
||||
|
||||
If you post your sheet as Gebobs suggested, we might be able to help
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post |
#5
|
|||
|
|||
What could be easier than AVERAGEIF?
|
#6
|
|||
|
|||
Here's the first 100 rows of the sheet. The rows that display are AL outfielders; the hidden row are NL outfielders.
So my understanding is that averageif takes three arguments: the first is the range of values [in this case, all the cells in column AB]; TRUE, which I understand references those cells that are seen, and then one last argument, which is another range of cells. Here's where I get lost: on this sheet, where does the final argument come from? Column AC is supposed to be Z values, so I also need STDEVIF for column AB as well, so I can then calculate the standard deviation from the mean for each AL player. Thanks! |
#7
|
|||
|
|||
oops. here's the sheet
see attached
|
#8
|
|||
|
|||
How did you hide the NL rows? Manually?
Are you just trying to get the average and stdev for AB by league? To use averageif for this, you would need a to distinguish between AL and NL. As the table is, you don't have that. =AVERAGEIF(range,criteria,averagerange) range is the range that you are testing, in this case which league each player is in. criteria is what you are testing for, in this case the leagues, AL and NL. averagerange would be what you want to average, in this case AB. In some cases, the first and last argument are the same, say for instance if you only wanted to average those player's AB who had 50 or more. In that case, the last argument is not necessary. So what you need to do is specify the league affiliation for each player. I would use the Format as Table function right away. It would make all this so much easier. I would do it for you but this is only a sample table and the work would be wasted since you would need to add the other players anyway. |
#9
|
|||
|
|||
Unfortunately, formatting the data as a table is still giving me the wrong result. And I haven't been clear on what the data is I'm interested in.
Yes, I did manually hide each row that was for an NL player. So league affiliation is already accounted for. What I am looking to compute is exclusively in the AB column, with the header "Final D score". In this column I need the average of the values that are not hidden, and the standard deviation of these values. When I entered AVERAGEIF (AB3:AB97, TRUE, AB3:AB97), I got a division by zero error. When I entered AVERAGEIF(AB3:AB97, TRUE), I got a division by zero error. AVERAGE results in the averaging of both the unhidden and hidden cells in column AB. Do feel free to muck about with the sheet. Anything you do I can cut and paste into a larger sheet with more values, or just to see it would tell me what I needed to do to apply it to the full sheet |
#10
|
|||
|
|||
Quote:
Quote:
The formula should be: =AVERAGEIF(AB3:AB97,">0") which equals 10.86 AFAIK, there is no STDEVIF function. See the attached mucking about. I applied the Format as Table functionality. I applied a filter to Final D score so no zeroes are displayed. Look at the totals row at the end. Click the dropdown and you can see several builtin functions for this cell: Sum, Average, Stdev. It is currently set to Average. Note the value: 10.86. The Subtotal formula only applies to the data currently allowed by the filter. If you apply other filters (e.g. Team = CLE), the average will update to reflect those data only. Now choose Stdev. There's your answer: 4.918. Nice huh? Also, look at the formulas you wrote for Final d score. With Format as Table automation, the formulas don't use cell addresses. They use the name of the variable as provided in your column headers: =[@[prorate%]]*SUM(Stats[@[r2]:[sb5]])+[@ba6] Another neat thing, if you insert a new row to add data, the formatting scheme is maintained automatically. And you can change the formatting scheme to whatever you want. I'm currently in my "green period" so this is the style I prefer. But there are dozens to choose from and you can even design your own. Anyhoo, let me know if you need more help. |
#11
|
|||
|
|||
My table isn't working like yours
When I converted the data to a table in the same sheet as you did, the filter on top of column AB didn't have a zero option to check or uncheck; what it had was "blank". so is there a particular type of table I should be using?
And, how did you create that nifty total row with the pull down functions? Is that also a function of the table itself? |
#12
|
|||
|
|||
Quote:
The total row can be added after you Format as Table. Go to Table Design on the ribbon, Table Style Options, check Totals row. |
Tags |
average |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
#REF! Error in calling VBA function disappears when function is copied | lcaretto | Excel Programming | 2 | 05-26-2014 07:19 PM |
Is this where i use the "average if function"????? | CSTEIGER | Excel | 2 | 11-21-2013 06:25 PM |
Creating a graph for Future Value function (FV function) | bmoody | Excel | 2 | 11-06-2013 10:52 AM |
Average for the month | joflow21 | Excel | 4 | 10-21-2013 06:57 AM |
'AVERAGE' Formula | nfphilpot | Excel | 3 | 11-24-2010 02:19 PM |