Function Problems

How to Sort Excel Table Groups While Keeping Team Members Together

Kushani NimanthikaKushani Nimanthika Nov 10, 2026 868 views

Question details

The user needs a method to sort data groups by their collective team scores without breaking up the individual team members or changing their original sequence, avoiding the use of VBA.

How to Sort Excel Table Groups While Keeping Team Members Together
Product
Excel
Device & OS
not provided
Scenario
When organizing data where rows belong to specific teams, applying a standard sort by score scrambles the members. The goal is to sort entire group blocks as cohesive units based on the group's specific metric.
Observed behavior
Standard Excel sorting treats each row independently, causing team members to be separated. The desired outcome is to maintain the intact team groups but reorder the entire blocks according to their team score.
Before you start

Ensure your dataset is formatted as an Excel Table with clear column headers (e.g., 'Group' and 'Score') and check if your version of Excel supports dynamic array functions like XLOOKUP and SORTBY.

Solution 1Recommended

Use a Dynamic Array Formula (LET, XLOOKUP, SORTBY)

Create a single formula using modern Excel functions to dynamically output the sorted groups without modifying or disrupting the original data structure.

This approach uses dynamic array functions available in modern spreadsheet software. It identifies unique groups, retrieves their corresponding overall score, assigns that score to all team members internally, and then sorts the entire array.

By utilizing the SEQUENCE function alongside SORTBY, it ensures that original row sequences within the groups are perfectly preserved.

1
Select the target cell

Click on an empty cell where you want the new sorted table to be generated. Ensure there is enough empty space below and to the right for the data to spill.

2
Construct the LET function

Start your formula with =LET(unique_group, UNIQUE(Table[Group]), to define the unique groups. This stores the individual team names as a variable in the background.

3
Match scores using XLOOKUP

Add variables inside the LET function to map the group scores: group_res, XLOOKUP(unique_group, Table[Group], Table[Score],,, -1) followed by filled_res, XLOOKUP(Table[Group], unique_group, group_res).

4
Sort the final array

Finish the formula with SORTBY(Table, filled_res, 1, SEQUENCE(ROWS(Table)), 1). This tells Excel to sort by the assigned group score first, and then by the original row order to keep members exactly as they were.

Use a Dynamic Array Formula (LET, XLOOKUP, SORTBY)
Dynamic Updates: Because this relies on dynamic arrays, whenever you update a team member's score in the original table, the sorted results will automatically update to reflect the new rankings.

Sort Complex Group Data Seamlessly in WPS Spreadsheet

WPS Spreadsheet fully supports advanced dynamic array functions like LET, XLOOKUP, and SORTBY. You can effortlessly sort teams while keeping members grouped together, exactly like in Microsoft Excel, without the need for complex VBA scripts.

  1. 1. Open your file in WPS Spreadsheet: Launch WPS Office and open your .xlsx file containing the team data.
  2. 2. Enter the dynamic formula: Select a blank cell and input your nested LET and SORTBY formula to generate the grouped dataset.
  3. 3. Press Enter to execute: Hit Enter. WPS Spreadsheet will instantly calculate and spill the dynamically sorted arrays, preserving your team members.
  4. 4. Save your work: Save your file seamlessly as an .xlsx document, preserving formula compatibility for anyone else who views it.
100% compatible with advanced Microsoft Excel formulas and .xlsx filesSupports dynamic array spilling for automated sorting and groupingFeatures a familiar, easy-to-use interface with zero learning curveLightweight performance capable of handling large datasets quickly
microsoft office alternative - wps office

Frequently Asked Questions

Why do team members get separated when I sort normally?

Standard sorting treats each row independently. If you sort purely by a score column that is only populated in one row per group, or if the scores vary by member, the spreadsheet separates the rows. You need a uniform 'Group Score' assigned to all members of the team to sort them together.

Do I need to use VBA to keep teams grouped when sorting?

No, VBA is not required. You can achieve this using modern dynamic array functions like SORTBY, LET, and XLOOKUP to generate a newly sorted array, or you can use standard helper columns to assign a universal sorting metric to your existing table.

Can I sort grouped data in older versions of Excel?

Yes. While you cannot use the SORTBY function in older versions, you can add a new helper column. Populate this column with the group's aggregate score using functions like MAX or VLOOKUP, and then use the Data > Sort menu to organize the table by this helper column.