简体   繁体   中英

Google Sheets - how can I return participants scores by team, sorted by score?

I have a sheet with participant scores, and each participant is in a team. In a second sheet, I have the following formula to create a subset of participant scores per team in each row.

Here's a link to a sheet with sample data showing my formula :

How can I get the results sorted in decreasing numerical order?

I've tried using the SORT() function (column C in the second sheet), but understandably, it interprets the results as text, so a score of 10 is ranked lowest.

Just replace 2nd parameter of SORT function with Score .

=if($A:$A="","",arrayformula(textjoin(" ",true,sort(if(Team=A2,Score&" ("&Name&")",""),Score,false))))

try this superior formula after you delete everything in range A:B :

={"Team", "Scores"; INDEX({UNIQUE(SORT(FILTER(data!B2:B, data!B2:B<>""))), 
 FLATTEN(SUBSTITUTE(TRIM(QUERY(REGEXREPLACE(SORT(QUERY(
 QUERY({data!B2:B, TEXT(data!C2:C, "000000")&CHAR(13)&"("&data!A2:A&")"}, 
 "select min(Col2) where Col1 is not null group by Col2 pivot Col1"),
 "offset 1", 0), SEQUENCE(COUNTA(data!A2:A)), 0), 
 "^0{1,5}", ),,9^9)), " ", CHAR(10)))})}

在此处输入图片说明

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