View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
vezerid vezerid is offline
external usenet poster
 
Posts: 751
Default How do I calculate a weighted median?

Not so sure, but from a website defining weighted median:

To calculate the weighted median of a set of numbers you need to find
the median and if this number does not exist in the recordset take the
average of the values above and below the median instead.

Weighted Median of 1,2,3,4,5 is 3 (Median is also 3)
Weighted Median of 1,2,3,4,5,6 is 3.5 (Median is also 3.5)
Weighted Median of 1,2,4,4,4,7,7,8,8,8 is 5.2 (((4+4+4) + (7+7))/5)
(Median is 5.5)

If this is so, then the following *array* formula will calculate the
weighted median of the numbers in A2:A11:

=(SUMPRODUCT(A2:A11*(A2:A11=MAX(IF(A2:A11<=MEDIAN( A2:A11),A2:A11))))
+SUMPRODUCT(A2:A11*(A2:A11=MIN(IF(A2:A11=MEDIAN(A 2:A11),A2:A11)))))/
(SUMPRODUCT(--(A2:A11=MAX(IF(A2:A11<=MEDIAN(A2:A11),A2:A11))))
+SUMPRODUCT(--(A2:A11=MIN(IF(A2:A11=MEDIAN(A2:A11),A2:A11)))))

Array formula: commit with Shift+Ctrl+Enter

HTH
Kostis Vezerides


On Jun 24, 7:38 pm, ac wrote:
Anybody know how to do it in Excel?