Data Import & Export

WPS Spreadsheet: Sort Mixed Excel Dates Chronologically

Adam DavisAdam Davis Nov 12, 2026 868 views

Question details

The user needs to sort a table chronologically when date entries use different formats, including full dates and four-digit years.

Product
WPS Spreadsheet
Device & OS
not provided
Scenario
A worksheet contains day/month/year date values alongside entries that contain only a four-digit year, and the user wants one chronological sort order.
Observed behavior
Mixed date formats cannot be reliably sorted as entered because four-digit years and complete dates may be interpreted differently.
Before you start

Check whether the full dates are stored as recognized date values and whether year-only entries contain exactly four digits. Confirm the data range, such as A2:A7, before entering the sorting formula.

Solution 1Recommended

Use SORTBY with a conversion rule for four-digit years

Use this dynamic-array formula when you want to sort the original entries while treating each year-only value as January 1 of that year.

The formula creates a chronological sort key for each entry. Values with four characters are converted to January 1 of that year, while complete date values are used as their existing dates.

1
Select an empty output cell

Open the worksheet in WPS Spreadsheet and click an empty cell where the sorted results should begin, such as C2.

2
Enter the SORTBY formula

Enter =SORTBY(A2:A7,IF(LEN(A2:A7)=4,DATE(A2:A7,1,1),A2:A7)) and press Enter. Replace A2:A7 with the actual range containing your mixed date entries.

3
Review the chronological results

Check the spilled results below the formula cell. Four-digit years appear in chronological order as January 1 of the corresponding year, followed by or alongside full dates according to their actual date values.

Use SORTBY with a conversion rule for four-digit years
Sorting rule: A year-only value such as 2024 is treated as January 1, 2024. If a full date is stored as text rather than a recognized date, convert it to a date value before sorting.

Sort Mixed-Date Excel Tables in WPS Spreadsheet

WPS Spreadsheet can sort mixed date data by generating a consistent chronological key for full dates and four-digit years. Use SORTBY for a formula-based result or a helper column for broader compatibility, then save the workbook in a familiar Excel format.

  1. 1. Open the workbook: Launch WPS Spreadsheet and open the Excel workbook containing the mixed date entries.
  2. 2. Select an output cell: Click an empty cell beside the source data where the sorted results can spill without overwriting existing content.
  3. 3. Apply the chronological formula: Enter =SORTBY(A2:A7,IF(LEN(A2:A7)=4,DATE(A2:A7,1,1),A2:A7)), adjusting A2:A7 to match your data range.
  4. 4. Verify and save the results: Review the sorted dates, then use File > Save As to save the workbook as an Excel Workbook (*.xlsx) when required.
Sorts full dates and year-only entries in one chronological orderSupports formula-based and helper-column workflows for mixed date dataProvides a familiar spreadsheet interface for importing and organizing tablesMaintains compatibility with Microsoft Excel .xlsx filesWorks with common Excel formulas and table-sorting operations
microsoft office alternative - wps office

Frequently Asked Questions

How does the formula handle a cell containing only a year?

IF(LEN(A2:A7)=4,DATE(A2:A7,1,1),A2:A7) converts a four-digit year into January 1 of that year, creating a sortable date value.

Can I sort the entire table instead of only the date column?

Yes. Use a helper Sort Key column, select the full table, open Data > Sort, and sort by Sort Key so the related row data stays together.

Why are some full dates still sorting incorrectly?

Those entries may be stored as text or may use an unrecognized date format. Convert them to valid date values first, or use a consistent regional date format before applying the sort.

What should I do if SORTBY is unavailable?

Create a helper column with =IF(LEN(A2)=4,DATE(VALUE(A2),1,1),A2), fill it down, and sort the full table by that helper column from oldest to newest.