The Weighted Average can be calculated by the use of the function:
=SUMPRODUCT(values; weights) / SUM(weights)
Weight and Value arrays need to be of the same length
- they can be on the same sheet just use a different column,
- you can multiply column by column, column by row, row by column, row by array,...
- The order of weights applied to each value need to be in order in the two arrays you specify
Note: if weights are already normalized then you don't need to divide by the sum of the weights (you will be dividing by 1)
Answer from Pau Coma Ramirez on Stack ExchangeHow to calculated weight averages
Apache OpenOffice Community Forum - [Solved] Multi-condition weighted average formulas - (View topic)
How to calculate a weighted median in LibreOffice Calc?
Apache OpenOffice Community Forum - [Solved] Help with weighted Averaging - (View topic)
Videos
| Person | Score |
|---|---|
| 1 | 80 |
| 1 | 90 |
| 1 | 30 |
| 2 | 55 |
| 3 | 60 |
| 3 | 70 |
I'm hoping to calculated a weighted average of all the scores - i.e. average of person 1 = 66.6, average of person 2 is 55, average of person 3 = 65. Therefore weighted average = 66.6+55+65/3=62.2.
Wondering how to do this on a larger scale? TIA!
Your formula currently is:
Sum(points / maxPoints * weights / sum(weights))
However you can transform it to this form without changing the output:
Sum(points / maxPoints * weights) / sum(weights)
With this you can easily calculate:
SUMPRODUCT(K23:N23;POWER(K22:N22;-1);K21:N21)/SUMIF(K23:N23;">=0";K21:N21)
Update:
If you have many rows with "point", then you need to combine absolute and relative references to calculate:
SUMPRODUCT(K23:N23;POWER(K$22:N$22;-1);K$21:N$21)/SUMIF(K23:N23;">=0";K$21:N$21)
Ok, here is what I came up with:
=SUMPRODUCT(K23:N23,POWER(K22:N22,-1),K21:N21/SUM(K21:N21),ISNUMBER(K23:N23)) / SUMPRODUCT(ISNUMBER(K23:N23))
I added the ISNUMBER check as you requested. However it did not seem to make any difference -- SUMPRODUCT already ignored column L because it produced an error.
Also, to get the average, I divided by SUMPRODUCT(ISNUMBER(K23:N23). This simply counts the numerical values, of which there are 3 in this example.
The end result of this formula is 0,247 which is simply 0,74 / 3.
EDIT:
Here is a formula that produces 0.74375 as expected for the second example:
=SUMPRODUCT(B3:E3,POWER(B2:E2,-1),B1:E1/SUMPRODUCT(B1:E1,ISNUMBER(B3:E3)),ISNUMBER(B3:E3))