Google 工作表:根据排序值进行密集排名

Google Sheets: Dense Ranking from sorted values

我有一个简单的 table,有 3 列:

[姓名][分数][排名]

对于第 3 列,我使用以下公式根据分数对每一行进行排名:

=RANK(C9,$C:$C,0)

问题是公式没有返回我期望的值。例如在最后一行它 returns 19 当它应该是 5.

我找到了其他排名公式(RANK.EQ,等等),但同样的问题发生了。

这里是 Google Sheet 在上下文中查看它:

https://docs.google.com/spreadsheets/d/1P1m7UHPPIcQLQkzpnk-SI1y7-0mhKytCWDjA6FJzFrM/edit?usp=sharing

感谢任何指导

你想要的结果可以用一个简单的MATCH公式来实现:

=match(round(C9,0),NamedRange1,0)

假设创建了一个数组(上面命名为 NamedRange1),例如:

=sort(unique(round(C9:C28,0)),1,0)

我认为结果符合预期。检查此 Ranking 维基百科页面(称为 'standard competition ranking')。它说:

Standard competition ranking ("1224" ranking)

In competition ranking, items that compare equal receive the same ranking number, and then a gap is left in the ranking numbers. The number of ranking numbers that are left out in this gap is one less than the number of items that compared equal. Equivalently, each item's ranking number is 1 plus the number of items ranked above it. This ranking strategy is frequently adopted for competitions, as it means that if two (or more) competitors tie for a position in the ranking, the position of all those ranked below them is unaffected (i.e., a competitor only comes second if exactly one person scores better than them, third if exactly two people score better than them, fourth if exactly three people score better than them, etc.).

Thus if A ranks ahead of B and C (which compare equal) which are both ranked ahead of D, then A gets ranking number 1 ("first"), B gets ranking number 2 ("joint second"), C also gets ranking number 2 ("joint second") and D gets ranking number 4 ("fourth").

你想要的是'dense ranking',可以通过pnuts的回答或类似这样的方式实现:

  1. G9设置为1
  2. G10设置为=if(round(C10,0)<round(C9,0), G9+1, G9)
  3. 复制G10并粘贴到G11:G28

样本 sheet 是 here

感谢@pnuts 和@sangboklee 提供的解决方案。我想我现在有一个很好的解决方案。这是 pnuts 的解决方案,只是简化了:

=match(round($C9,0),sort(unique(round($C:$C,0)),1,false),0)

这本质上是 "embeds" 在单个公式中创建的数组,可以应用于所有行。作为奖励,这些值甚至不必排序。

请大家检查一下是否正确,但我认为这可行。我已经更新了原始问题描述中的链接 Google Sheet(它是 "Solution 2b")。