Calculating percentile rankings and corresponding values