Question

I have some ranked data that looks something like this in an excel spreadsheet.

1.3
1.3
1.3
1.4
1.6
1.6
1.7
1.8
1.9
2
2
2.3
2.3
2.3
2.4
2.7
3.1
3.3
3.3
3.4
3.4
4
4.2
4.5
4.7
4.9
5.8
6.1
6.7

I'm looking to make a calculator for the Mann-Whitney U-test and for that I need to rank these samples, simple enough using the =RANK() function in Excel, but I need to settle ties in the ranks for the test. The Mann-Whitney method involves taking the average of the ranks. For example, my first 3 values are 1.3 so I need excel to assign all 3 of these values the rank of (1+2+3)/3 (=2). At the moment the =RANK() function just ranks all 3 as 1.

I've seen some similar questions here solved using the IF command but have had trouble appling them to my data.

Any help would be greatley appreciated.

Thanks,

Sam

Was it helpful?

Solution

Which version of Excel are you using? If you have Excel 2010 or later then there is a specific function for this, RANK.AVG, e.g. if your data is in A2:A30 use this formula in B2 copied down to rank as required

=RANK.AVG(A2,A$2:A$30,1)

In earlier versions of Excel you can use this formula to give you the same results

=RANK(A2,A$2:A$30,1)+(COUNTIF(A$2:A$30,A2)-1)/2

OTHER TIPS

You can cheat a little to get duplicates with different ranks. You will need a helper column

I'm going to assume the list of numbers starts @ A1...

in B1, enter the formula =A1+ROW()/10000 - this will add on a small amount to the number - not enough to put it into the next value, but enough to distinguish between values

In C1, enter the formula =RANK(B1,$B$1:$B$29,1) to get the new rankings, with no duplicates.

Then copy B1 & C1 down to complete the table. You can hide column B if you don't want the intermediate cells shown

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top