[英]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.