简体   繁体   English

在 Google 表格中创建排名列,为相等的值提供“=”前缀

[英]Create rank column, providing "=" prefix for equal values, in Google Sheets

I am looking to create a formula that gives the rank of a list of pre-ordered numbers, but sets the ranking of equal values to the appropriate rank with "=" before it.我希望创建一个公式,该公式给出预排序数字列表的排名,但将相等值的排名设置为在其前面带有“=”的适当排名。 I am using Google Sheets, but I imagine any potential solution is likely to work in Excel?我正在使用 Google 表格,但我想任何潜在的解决方案都可能适用于 Excel?

So, if there's a list of 5 numbers:因此,如果有 5 个数字的列表:

**Values**
10
8
8
6
4

They will have a Rank column:他们将有一个排名列:

**Rank**    **Values**
  1             10
  =2            8
  =2            8
  4             6
  5             4
=ARRAYFORMULA(IF(COUNTIF(A1:A, A1:A)>1=FALSE,
 IF(A1:A<>"", RANK(A1:A, INDIRECT("A1:A")), ), "="&
 IF(A1:A<>"", RANK(A1:A, INDIRECT("A1:A")), )))

在此处输入图片说明

You are not going to be able to create =2.您将无法创建 =2。 I don't know ant spreadsheet that will accept that.我不知道蚂蚁电子表格会接受那个。 A `=2 will work as it is treated as a string. `=2 将工作,因为它被视为字符串。 If you will just take the ranking RANK works well (it will return 2).如果你只是拿排名 RANK 效果很好(它会返回 2)。 If your values are in column A without a Header, place this in B1.如果您的值在没有标题的 A 列中,请将其放在 B1 中。

=arrayformula(if(A1:A<>"",RANK(A1:A,indirect("A1:A")),"")) =arrayformula(if(A1:A<>"",RANK(A1:A,indirect("A1:A")),""))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM