Sort Unique Semester Labels by Custom Order and Year in Excel
Question details
Create a unique list of semester labels sorted by a custom semester order and then by year.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet contains repeated semester labels that should appear once in a custom-sorted list.
- Observed behavior
- The desired list places semesters in the specified order, such as Spring before Fall, and sorts years within each semester.
Make sure each label has a consistent numeric semester order and year, such as 1 for Spring and 2 for Fall. The formula below assumes these values are stored in an Excel table named Table1 with columns named Term, SemesterOrder, and Year.
Use a formula to sort unique labels by semester and year
Use this approach in a modern version of Excel that supports dynamic arrays, LET, SORTBY, UNIQUE, and XLOOKUP.
The formula first creates a unique label list, then looks up each label's semester order and year. All occurrences of the same label must have the same order and year.
Select the source data and choose Insert > Table. Name the table Table1 and use the column headers Term, SemesterOrder, and Year.
Click an empty cell outside the table and enter =LET(labels,UNIQUE(Table1[Term]),SORTBY(labels,XLOOKUP(labels,Table1[Term],Table1[SemesterOrder]),1,XLOOKUP(labels,Table1[Term],Table1[Year]),1)).
Press Enter and check the spilled list. Labels with the lowest semester-order number appear first, with their years in ascending order.

Remove duplicate labels and sort with helper columns
Use this manual method when you do not have the required dynamic-array functions.
Create a custom-sorted semester list in WPS Spreadsheet
Use WPS Spreadsheet to remove repeated labels from a copy of your data and sort the remaining rows by semester order and year.
- 1. Open the workbook: Open your Excel workbook in WPS Spreadsheet and select the worksheet containing the semester data.
- 2. Copy the columns: Copy the label, numeric semester-order, and year columns to a blank worksheet.
- 3. Remove duplicates: Select the copied range, choose Data > Remove Duplicates, and use the label column as the duplicate criterion.
- 4. Sort the list: Select the remaining range and choose Data > Sort. Sort by semester order ascending, then add a year sort level in ascending order. Copy the label column wherever you need the finished list.

Frequently Asked Questions
How do I put Spring before Fall regardless of year?
Assign Spring an order value of 1 and Fall a value of 2. In Data > Sort, sort by the order column first and the year column second, both ascending.
Can I sort the labels chronologically instead?
Yes. Use a real start-date column and sort it from oldest to newest. This typically groups terms by year first rather than placing every Spring label before every Fall label.
Why does the formula return the wrong order for a label?
Check that every occurrence of the label has the same SemesterOrder and Year values. XLOOKUP uses the first matching row to determine the sort keys.
Will the manually created list update when I add rows?
No. Copy the updated source columns and repeat Data > Remove Duplicates and Data > Sort. The dynamic-array formula can update automatically when rows are added to the Excel table.




