Joint vs Equal rankings with Excel’s Rank() and Rank.EQ()
Office for Mere Mortals helps people around the world get more from Word, Excel, PowerPoint and Outlook. Delivered once a week. free.
It’s a small difference but can make your reports or merged documents look a lot more professional.
Use the Choose() function to choose between unshared, joint and shared equal rankings.
Choose() uses the first parameter (the number of rankings that have the same result from CountIF) and returns the string in the next places. If the value is 1, the second parameter and so on.
And you need to add the rank as well:
=[@Rank]&" "&CHOOSE(COUNTIF([Rank],[@Rank]),"","joint", "equal")
That Choose() formula only copes with two or three rows with the same rank. In practice, you need to add more parameters to handle four or more equal place getters.
This will handle up to 8 rows/places with the same ranking.
Custom Function alternative for Rank()
For a more comprehensive alternative, try this custom function RankName()
Function RankNameSuffix(pNumber As String) As String
' returns a suffix depending on the number of equal rankings.
Select Case CLng(VBA.Right(pNumber, 1))
RankNameSuffix = ""
RankNameSuffix = "joint"
RankNameSuffix = "equal"
Office Watch has the latest news and tips about Microsoft Office. Independent since 1996. Delivered once a week.