Microsoft KB Archive/79238

{| = Excel: MEDIAN Function Returns Incorrect Results =
 * width="100%"|

Last reviewed: November 3, 1994

Article ID: Q79238

SUMMARY
The MEDIAN function in Excel for Windows version 3.0 may return incorrect results. The error occurs when an even number of values are calculated with the MEDIAN function and the two middle values are equal. The problem does not exist in any other version of Excel.

MORE INFORMATION
The MEDIAN function returns the middle number in a range of sorted values if the range contains an odd number of values, or returns the average of the two middle values if the range contains an even number of values.

Comparing an even number of values may lead to incorrect results. If the two middle values are the same, the MEDIAN function will incorrectly calculate the average of the two values that surround the middle values. When an odd number of values are compared, the MEDIAN function returns correct values.

Step to Reproduce Problem
  Enter the following into a worksheet: A1: 1               B1:  1          C1:  1          D1:  1 A2: 3               B2:  2          C2:  2          D2:  2 A3: 5               B3:  5          C3:  2          D3:  3 A4:                 B4:             C4:  10         D4:  10 A5: =MEDIAN(A1:A4)   Select cells A5:D5 and choose Fill Right from the Edit menu. The values returned to row 5 are as follows: A5: 3        B5:  2          C5:  5.5        D5:  2.5

The values that should be returned into row 5 are:

A5: 3        B5:  2          C5:  2          D5:  2.5 