Forum Discussion

espensun's avatar
espensun
Copper Contributor
Oct 19, 2024
Solved

Sorting a table with groups of people (no VBA)

Hi, I have a table with groups of people in a team. The individual team can vary from 3 to 4 persons. The table list the group and their group score/result (se attached image). How can I sort the t...
  • Lorenzo's avatar
    Oct 19, 2024

    espensun 

    If you already have GROUPBY:

     

    =LET(
      grouped,      GROUPBY( Table[Group], Table[Res.], SUM,, 0 ),
      filled_res,   XLOOKUP( Table[Group], CHOOSECOLS( grouped, 1 ), CHOOSECOLS( grouped, 2) ),
      sorted,       SORTBY( Table,
                      filled_res, 1,
                      SEQUENCE( ROWS( Table ) ), 1
                    ),
      IF( ISBLANK( sorted ), "", sorted )
    )

     

Resources