When data are measured on, at least, an ordinal scale, the ordered categories can be replaced by their
ranks and Pearson’s correlation coefficient calculated on these ranks. This is called Spearman’s rank correlation coefficient (r
_{s}) and provides a measure of how closely two sets of rankings agree with each other.
Note: this is not a measure of linear association.
For example, two doctors may assess the condition of eight patients suffering from particular symptoms. To do this they rank the patients from 1 (best) to 8 (worst):
Patient

Doctor A

Doctor B

1

4

5

5

1

3

3

3

1

4

2

2

5

6

6

6

5

4

7

8

7

8

7

8

A significant association between the sets of ranks by calculating Spearman’s rank correlation coefficient (rs) is indicated by p = 0.05, as usual. The value of rs ranges from 1 to +1. Results indicate that there is evidence to suggest good agreement (rs = 0.86) between the doctors' assessments (p = 0.007).
Computer output from SPSS
Analyse>Correlation>Bivariate
Formula for calculating Spearman’s correlation coefficient
The following formula can be used to calculate this coefficient, it is where Sd^{2} is the sum of the squared differences between the pairs of ranks, and n is the number of pairs.
The advantages of this coefficient are that, if calculation is to be done by hand, it is easier to calculate, and can be used for any data that can be ranked  which includes quantitative data.