FormulaCraft

How to rank values with a tiebreaker in Excel and Google Sheets

Topic:RANK & statistical aggregates
Excel & Google Sheets
=RANK(B2,$B$2:$B$6,0)+COUNTIFS($B$2:$B$6,B2,$A$2:$A$6,"<"&A2)

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Put the primary score to rank in B2:B6 and the tiebreaker value in A2:A6 (e.g. an entry date — the earlier date wins the tiebreak).
  2. 2In C2 enter =RANK(B2,$B$2:$B$6,0)+COUNTIFS($B$2:$B$6,B2,$A$2:$A$6,"<"&A2). RANK gives the base position; COUNTIFS counts rows with the same score but a smaller tiebreaker value, pushing later entries down.
  3. 3Copy C2 down through C6. Each row should receive a unique rank from 1 to 5.
  4. 4Verify by sorting column C: ranks should form a continuous 1-through-n sequence with no duplicates or gaps.
  5. 5For descending rank (smallest score = rank 1), change the RANK third argument from 0 to 1 and the COUNTIFS comparison from "<" to ">".

Tips

Need it for your exact data?

Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.

Frequently asked

Why does my formula still produce gaps like 1, 1, 3 instead of 1, 2, 3?

Without the COUNTIFS addition you get standard RANK behavior. Confirm the COUNTIFS criteria ranges match the data ranges exactly and the comparison operator is correct for your tiebreaker direction.

Can I use SORTBY and SEQUENCE to rank instead?

In Excel 365 and Sheets, SORTBY then assigning 1-n with SEQUENCE is clean but produces a separate sorted list rather than in-place ranks next to the original data.

More on RANK & statistical aggregates

See all →

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: