Spearmans Rank

dodgymanc

New Member
Joined
Mar 28, 2003
Messages
4
Is there a formula or function on Excel that allows me to calculate Spearmans Rank Correlation Coefficient?
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Aladin,
Following you pattern, I think instead of =IF(ISNUMBER(Q3), it should be the formula below.

E3:

=IF(ISNUMBER(B3),AVERAGE(RANK(B3,$B$3:$B$14),RANK(B3,$B$3:$B$14)+COUNTIF($B$3:$B$14,B3)-1),"")

Thanks
 
Upvote 0
Aladin,
Following you pattern, I think instead of =IF(ISNUMBER(Q3), it should be the formula below.

E3:

=IF(ISNUMBER(B3),AVERAGE(RANK(B3,$B$3:$B$14),RANK(B3,$B$3:$B$14)+COUNTIF($B$3:$B$14,B3)-1),"")

Thanks

Yeah...

ISNUMBER(Q3) --> ISNUMBER(B3)

Who knows how Q3 has got there! A moderator could correct for that in order to avoid errors when people try to use the set up.
 
Upvote 0
Here is an Excel UDF that I created for the Spearman Ranking Correlation Coefficient. Example, "=Spearman(C3:C12, D3:D12)"

Public Function Spearman(rangeX As Range, rangeY As Range) As Variant

' Spearman Ranking Correlation Coefficient - created by Jeffrey A. Shaffer
' = Spearman (Range of X variables, Range of Y variables)
' d refers to the difference in the rank orders
' 6 is a constant in the formula
' r = 1 - 6 * sum of (dSquared/N(NSquared-1))

If rangeX.Count <> rangeY.Count Then
MsgBox "Total number of X and Y variables does not match."
End If

Dim denominator As Integer
Dim numerator As Integer
Dim dSquared As Integer
dSquared = 0
denominator = rangeX.Count * ((rangeX.Count ^ 2) - 1)

For iCount = 1 To rangeX.Count
dSquared = dSquared + ((WorksheetFunction.Rank(rangeX(iCount), rangeX) - WorksheetFunction.Rank(rangeY(iCount), rangeY)) ^ 2)
Next iCount
numerator = dSquared * 6

Spearman = 1 - (numerator / denominator)
End Function
 
Upvote 0
hi i am new to this forum . I am not going to post a direct link to a resouce but still i am putting it as text as i have found 3 example spreadsheets
http://freespreadsheet.net/2015/04/spearman-rank-correlation-in-excel.html and yes this is mine blog
 
Upvote 0

Forum statistics

Threads
1,215,223
Messages
6,123,714
Members
449,118
Latest member
MichealRed

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top