简体   繁体   中英

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:

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. 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. Additionally, the rank should only be the same item in column B and different for each item.

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

=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))))})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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