How to rank values without ties
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)Give every row a distinct rank even when values are equal — no shared 2nd place.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =RANK(B2,$B$2:$B$6)+COUNTIF($B$2:B2,B2)-1 | Fill down. Earlier rows win ties; add a second criterion to COUNTIF to break ties differently. |
| Google Sheets | =RANK(B2,$B$2:$B$6)+COUNTIF($B$2:B2,B2)-1 | Identical. |
| LibreOffice Calc | =RANK(B2,$B$2:$B$6)+COUNTIF($B$2:B2,B2)-1 | Identical. |
How it works
Plain RANK gives both 20s rank 2 and skips rank 3. Adding COUNTIF with the expanding range counts how many times the value has appeared so far: the first 20 gets 2+1−1=2, the second gets 2+2−1=3. Every rank is now distinct, with earlier rows winning ties — which makes the ranks safe to use as INDEX/MATCH keys for building sorted leaderboards in versions without SORT/SORTBY.
Verified, not just documented
We ran =RANK(B4,$B$2:$B$6)+COUNTIF($B$2:B4,B4)-1 in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 3 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 3 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
RANK · COUNTIF — see full Excel, Google Sheets & LibreOffice compatibility for each.
Related recipes
- How to check if a value exists in a list
- How to count cells that contain specific text
- How to count cells greater than a value
- How to count cells above the average
- How to count cells not equal to a value