Search code examples
arrayssortinggoogle-sheetssumgoogle-query-language

arrayforumla + sorting (googlesheets) sorting dynamic data


I'm using a googleform to collect info about game players and their scores for different games, and am trying to create a leaderboard.

I've used an ARRAYFORMULA in col A to bring back unique values of each Player, then another in col B to SUMIF their Scores. So it's a leaderboard, I want it to autosort by score descending.

I've tried using various scripts etc but it seems that even just using the Sort function doesn't work. It sorts for a second, then resets back to the order the Players appear on the Form Responses. I'm taking this to mean I can't sort dynamic data in this way.

Any ideas on how I can autosort this, so even when more Players are added it will always act as a leaderboard?

EDITED TO ADD LINK: https://docs.google.com/spreadsheets/d/1oitJrH-TdeRFfHCCTf9XO2ma4qwN571cPkYJhhPKKi8/edit?usp=sharing

screenshot of googlesheet


Solution

  • try:

    =QUERY(CombinedScores!A2:B, "order by B desc", )
    

    enter image description here