How to Rank Text Uniquely in Google Sheets

Published on

When you rank text values in Google Sheets, duplicates normally receive the same rank. For example, in the table below, every “apple” is ranked 1, which can be fine in some cases — but not when you need unique ranks for each entry.

Sorted list example:

Google Sheets example showing a sorted list where identical text values receive the same rank and unique ranks in a separate column

Even in an unsorted list, the issue remains — ties get the same number, leaving gaps in the ranking sequence.

Unsorted list example:

Google Sheets example showing an unsorted list where identical text values receive the same rank and unique ranks in a separate column

In this tutorial, you’ll learn how to rank text uniquely in Google Sheets, so each item gets its own rank number, even if there are duplicates.

Why the Regular Alphabetical Ranking Formula Doesn’t Work

A normal alphabetical ranking formula gives the same rank to duplicates — “apple” at #1 for every occurrence. For unique ranks, each duplicate needs its own number: first “apple” gets #1, second gets #2, and so on.

How This Works (Concept Overview)

Whether your list is sorted or unsorted, the idea is the same.

We combine two counts:

  1. Count of Text Below – How many items are alphabetically less than the current item.
  2. Running Count of Text – The position of the current item among duplicates.

Generic Formula:

Unique Rank of Text = Count_of_Text_Below + Running_Count_of_Text

Example with a Sorted List

Sample Data

ItemCount_of_Text_BelowRunning_Count_of_TextUnique Rank of Text
apple011
apple022
apple033
grape314
grape325

Explanation:

  • For "apple", there are no items less than it, so Count_of_Text_Below = 0.
  • For "grape", there are 3 apples less than it, so Count_of_Text_Below = 3.

The Running Count just counts each duplicate’s position in sequence.

Formula to Rank Text Uniquely in Google Sheets (Non-Array Version)

If you want to use a standard drag-down formula:

=COUNTIF($B$2:$B,"<"&B2) + COUNTIF($B$2:B2,B2)
Google Sheets screenshot demonstrating a drag-down formula that assigns unique ranks to text values, including duplicates

Parts of the formula:

  • COUNTIF($B$2:$B,"<"&B2) → Count of text below
  • COUNTIF($B$2:B2,B2) → Running count of the text

Works on both sorted and unsorted lists.

Formula to Rank Text Uniquely in Google Sheets (ArrayFormula Version)

If you prefer a single ArrayFormula that auto-fills down:

=ArrayFormula(
  IF(B2:B="",,
    COUNTIF(B2:B,"<"&B2:B) +
    COUNTIFS(B2:B,B2:B,ROW(B2:B),"<="&ROW(B2:B))
  )
)

Breakdown:

  • COUNTIF(B2:B,"<"&B2:B) → Count of text below
  • COUNTIFS(B2:B,B2:B,ROW(B2:B),"<="&ROW(B2:B)) → Running count of text
  • IF(B2:B="",,) → Prevents output in blank rows

Why This Method is Reliable

  • Works on sorted or unsorted lists
  • Handles any number of duplicates correctly
  • Fully compatible with Google Sheets’ dynamic array behavior
Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Top Discussions

More like this

Pivot Table Formatting, Output & Special Behavior in Google Sheets

Pivot Tables in Google Sheets are powerful—but they can get tricky once you move...

Pivot Table Calculations & Advanced Metrics in Google Sheets

When it comes to built-in tools for data analysis and visualization in Google Sheets,...

Google Sheets Pivot Table Tutorial: Basics, Setup, and Date Grouping

The easiest way to summarize, analyze, and report data in Google Sheets is by...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.