简体   繁体   English

基于两列条件的 Google 表格中的排名和数组公式

[英]Rank and Array Formulas In Google Sheets based on criteria from two columns

I am struggling to rank two columns with an array formula:我正在努力用数组公式对两列进行排名:

The current formula:当前公式:

=if(B2<>"",if(B2=B1,if(C1=1,2, C1+1),1),)

Here is a link to the Google Sheet sample:以下是 Google Sheet 示例的链接:

https://docs.google.com/spreadsheets/d/14BX3mO2Nd-RTMyhivwJ9w_rnVbVjSqE72o3Rdx-GQME/edit?usp=sharing https://docs.google.com/spreadsheets/d/14BX3mO2Nd-RTMyhivwJ9w_rnVbVjSqE72o3Rdx-GQME/edit?usp=sharing

I'd like to be able to create an array formula in Column C but multiple attempts has me stumped if that's possible.我希望能够在 C 列中创建一个数组公式,但如果可能的话,多次尝试让我难倒。 Essentially Column C should be ranked in order of lowest $ to highest $ from column A and the order in which it appears so rank values do not repeat.本质上,C 列应该按照 A 列的最低 $ 到最高 $ 的顺序以及它出现的顺序排列,这样排名值就不会重复。 Additionally, the rank should only be the same item in column B and different for each item.此外,排名应该只是 B 列中的相同项目,并且每个项目都不同。

您可以像这样对数据进行排名:

=arrayformula(query({sort({row(A2:A),A2:B},3,1,2,1), sort({COUNTIFS(B2:B,B2:B,row(B2:B),"<=" & row(B2:B)),B2:B},2,1,1,1)}, "Select Col4 where Col4<>0 Order by Col1 "))

如果放在 C1 中,这应该可以工作:

=ARRAYFORMULA({"Rank";IF(B2:B="",,COUNTIFS(B2:B,B2:B,A2:A+1/(1000*ROW(A2:A)),"<="&A2:A+1/(1000*ROW(A2:A))))})

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

相关问题 Google表格基于多个条件的COUNTIF / COUNTIFS公式 - Google Sheets COUNTIF / COUNTIFS formulas based on multiple criteria 如何对具有两列匹配条件的工作表中的行进行排名 - How to RANK rows in Sheets with two columns matching criteria 根据多行中多个单元格的匹配条件以及 Google 表格中另一个表的排名返回值 - Returning Values Based on Matching Criteria of Multiple Cells in Multiple Rows plus Rank from another Table in Google Sheets 根据 Google 表格中的条件返回一个数组 - Return an array based on Criteria in Google Sheets 如何有效地使用 Google 表格中的公式将范围内的最新值与基于多个标准的平均值进行比较? - How to compare latest value in range with averages based on multiple criteria using formulas in Google Sheets efficiently? Google表格-使用基于多个列的OR条件进行条件格式 - Google sheets - Condition formatting using OR criteria based on multiple columns 如何在谷歌表格中组合嵌套数组公式? - How to combine nested array formulas in google sheets? Google表格:按一列分组并按两列排名 - Google Sheets : Group By one column and Rank by 2 columns 使用数组公式连接两个独立的工作表 - Use array formulas to concatenate two independent sheets 比较Google表格中两列的数据 - compare data from two columns in google sheets
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM