Microsoft KB Archive/828678

= Excel statistical functions: Representing ties by using RANK =

Article ID: 828678

Article Last Modified on 2/2/2007

-

APPLIES TO


 * Microsoft Office Excel 2007
 * Microsoft Office Excel 2003

-



SUMMARY
This article discusses how to use RANK to give an average rank value to tied observations.



MORE INFORMATION
When you convert numeric data to ranks, you may want to represent ties so that the tied observations each receive an average rank over all such observations instead of the lowest possible rank. The numeric example in this article illustrates this.

Although the current version of RANK returns the appropriate results for most situations, this article discusses the situation where a tie occurs. For example, you may want RANK to handle ties if you are using a non-parametric statistical hypothesis test that involves ranks.

The method that this article describes is also described in the RANK Help file for Microsoft Office Excel 2003 and for later versions of Excel (but not in earlier RANK Help files). This procedure works equally well for all versions of Excel. The RANK function itself has not changed.

Syntax
RANK(number, ref, order)

Note must have a numeric value;   must be an array or cell range that contains numeric data values;   is optional. If you omit, or assign it a value of 0 (zero), the rank of   is the position of   in   if   is ranked in descending order. If  is assigned any non-zero value,   is assumed to be ranked in ascending order.

Example of usage
To illustrate this use of RANK, create a blank Excel worksheet, copy the following table, select cell A1 in your blank Excel worksheet, and then click Paste on the Edit menu so that the entries in the following table fill cells A1:F12 in your worksheet.

Note In Microsoft Office Excel 2007, the Paste command is in the Clipboard group on the Home tab.

Note After you paste this table into your new Excel worksheet, click the Paste Options button, and then click Match Destination Formatting.

In Excel 2003, with the pasted range still selected, point to Column on the Format menu, and then click AutoFit Selection.

In Excel 2007, with the pasted range still selected, click Format in the Cell group on the Home tab, and then click AutoFit Column Width.

For some purposes, you may want to use a definition of rank that takes ties into account. To do so, add the following correction factor to the value that RANK returns. This correction factor is appropriate where rank is computed in descending order ( = 0 or omitted) or ascending order (  = nonzero value).

(COUNT(ref) + 1 – RANK(number, ref, 0) – RANK(number, ref, 1))/2.

The worksheet illustrates this definition of rank. Data is in cells A1:A12. Ranks that RANK returns in ascending order are in cells B1:B12. Observations in cells A2:A5 are tied with a common value of 21. This produces a common rank of 2. There is one lower-ranked observation, 10. These four values of 21 take up ranked positions 2, 3, 4, and 5 and have an average rank of (2 + 3 + 4 + 5)/4 = 3.5. Similarly, the two observations in cells A6:A7 are each 33, there are five observations with lower rank. Therefore, these two observations take up ranked positions 6 and 7 and have an average rank of (6 + 7)/2 = 6.5. Finally, the three observations in cells A8:A10 have a common value, 52. There are seven observations with lower rank. Therefore, these three observations take up ranked positions 8, 9, and 10 and have an average rank of (8 + 9 + 10)/3 = 9.

Entries in column C contain the correction factor for tied ranks and show these average ranks that take ties into account. The values in columns B and C are exactly the same where observations are not tied with other observations, such as rows 1, 11, and 12.

Cells E1:E12 contain ranks that RANK returns in descending order. There are two entries with lower ranks than the three entries in cells A8:A10. Cells A8:A10 have a common value, 54. Therefore, these three entries take up ranked positions 3, 4, and 5 and have an average rank of (3 + 4 + 5)/3 = 4. There are five entries with a lower rank than the two entries in cells A6:A7. Cells A6:A7 have a common value, 33. Therefore, these two entries take up ranked positions 6 and 7 and have an average rank of (6 + 7)/2 = 6.5. There are seven entries with lower ranks than the four entries in cells A2:A5. Cells A2:A5 have a common value, 21. Therefore, these four entries take up ranked positions 8, 9, 10, 11 and have an average value of (8 + 9 + 10 + 11)/4 = 9.5.

Entries in column F contain the correction factor for tied ranks and show these average ranks that take ties into account. The values in columns E and F are exactly the same where observations are not tied with other observations, such as rows 1, 11, and 12.

Conclusions
This article describes and illustrates a correction factor that you can use to account for tied ranks when you rank data. You can use the correction factor together with the RANK function. The correction factor works equally well when ranks are in ascending or descending order.

Keywords: kbexpertisebeginner kbinfo KB828678

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.