Tied rank adjustment for Spearman Correlation
After finding the two rank vectors Rank_a and Rank_b, just calculate the correlation coefficient of ranks:

c = cov(Rank_a,Rank_b)/(std(Rank_a)*std(Rank_a))

From Wikipedia, you can only use 
$$C=1−\frac{6\Sigma(R_x−R_y)^2}{n(n^2−1)}$$ if the ranks are distinct integer values (in this case are not).


  If ties are present in the data set, this equation yields incorrect results.