How to compute the sum of ranks for each related group
Sum of ranks in group $i$
Arrange your data in an $N \times k$ matrix, where the $N$ rows represent the $N$ blocks (usually the subjects), and the $k$ columns represent the $k$ related groups (usually the repeated measurements)
For each row (subject) separately, arrange the observations from smallest to largest. The rank of an observation is its position in this ordered list. If there are ties, assign them the average of the ranks they occupy
The sum of ranks in group $i$ is the sum of rank scores in that group. That is, the sum of ranks in group $i$ is the sum of all the rank scores in the column for group $i$