**When comparing two independent samples, you want to rank *all the data* together.** Revising your example: **Sample A** value rank 20 7.5 20 7.5 20 7.5 20 7.5 25 10 and **Sample B** value rank 1 1 2 2 3 3 4 4 5 5 **What is going on?** Sample B's value of 1 is the lowest ordered value **from *both* samples**, so it gets a rank of 1. Similarly for Sample B's values of 2–5. The mean rank for Sample B is therefore $\frac{1+2+3+4+5}{5}=2.5$. Sample A's values of 20, 20, 20, and 20 occupy the 6th, 7th, 8th, and 9th ranks together, so they each get the average rank of $\frac{6+7+8+9}{4\text{ rank positions}}=7.5$. Finally, Sample A's value of 10 is the largest value **from *both* samples** so it gets the highest rank 10. The mean rank for Sample A is therefore $\frac{7.5+7.5+7.5+7.5+10}{5}=8$. **Bonus:** To be super explicit: **No. The mean ranks of two independent samples of the same $\boldsymbol{N}$ will *not* necessarily have the same mean ranks.**