Alphabetical ranking

Today I faced the challenge of having to find the rank of a text string in a range of text strings. Or put another way, in what position would the entry sit alphabetically?

The RANK function only works on numeric values. So instead, we have to resort to logic.

=COUNTIF(A1:A5,"<="&A1)

This will figure out how many cells within the range A1:A5 are less than or equal to A1, the value that we're trying to rank.

A beautiful yet simple piece of logic, learned from "anhn" inĀ VB Forums.

This entry was posted in Quick tips and tagged , . Bookmark the permalink.

3 Responses to Alphabetical ranking

Leave a Reply

Your email address will not be published. Required fields are marked *