How to compute the sum of ranks for each group

Sum of ranks in group $i$
  1. Arrange all observations from smallest to largest, and mark the observations which belong to group $i$
  2. The rank of each observation is its position in this ordered list. If there are ties, assign them the average of the ranks they occupy
  3. Sum the ranks that belong to group $i$