Why are my dates not sorting correctly in Excel?
Excel formula
=SORTBY(A2:C8,DATEVALUE(A2:A8))The dates are text, so they sort character by character. Sort by the converted dates: =SORTBY(A2:C8,DATEVALUE(A2:A8)).
- Result on the example
- a 7-row list that spills from E2 in
E2 - Works in
- Excel 2021, 2024 and Microsoft 365
- Google Sheets
- Different formula, see below
See it work
The formula is already in E2. Change any input and the result updates, or edit the formula to experiment.
How it works
These dates are text, so a sort compares characters: "1" comes before "2", which puts October ahead of February. SORTBY sorts the rows by a second array, here the real dates DATEVALUE makes from the text, so the order is chronological. Google Sheets has no SORTBY, but its SORT accepts the converted dates as the sort column.
=SORTBY(A2:C8,DATEVALUE(A2:A8))Result{7 rows × 3 cols} "11/18/2025", "SO-095", 540, "12/1/2025", …
A2:C87 rows × 3 cols: "10/2/2026", "SO-114", 420, "2/15/2026", …A range: 7 rows × 3 columns.
A2:A87 rows × 1 col: "10/2/2026", "2/15/2026", "9/30/2026", "12/1/2025", …A range: 7 cells in one column.
DATEVALUE(A2:A8){7 rows × 1 col} 46297, 46068, 46295, 45992, …DATEVALUE: Converts date text to a date.- date_text
A2:A87 rows × 1 col: "10/2/2026", "2/15/2026", "9/30/2026", "12/1/2025", …
- date_text
SORTBY(A2:C8,DATEVALUE(A2:A8)){7 rows × 3 cols} "11/18/2025", "SO-095", 540, "12/1/2025", …SORTBY: Sorts a range by other ranges. Spills.- array
A2:C87 rows × 3 cols: "10/2/2026", "SO-114", 420, "2/15/2026", … - by_array1
DATEVALUE(A2:A8){7 rows × 1 col} 46297, 46068, 46295, 45992, …
- array
In Google Sheets
Google Sheets needs a different formula: =SORT(A2:C8,ARRAYFORMULA(DATEVALUE(A2:A8)),TRUE). On the same data it gives the same result. Here it is running in Google Sheets mode.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =SORTBY(A2:C8,--A2:A8) | spills 7 × 3 | Converts with -- instead of DATEVALUE; the order is the same. |
Common mistakes
- Sorting text dates A to Z puts "10/2/2026" before "2/15/2026", because text sorts character by character.
- The dates in the result are still text. Convert the column for good with DATEVALUE or Text to Columns, and every sort and filter works.
- Text dates in day/month order need the DATE(RIGHT, MID, LEFT) conversion instead.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Why are my dates not sorting correctly
E2, return the orders sorted from the oldest to the newest date, although the dates in column A are text.Questions
How do I sort newest first?
Add -1: =SORTBY(A2:C8,DATEVALUE(A2:A8),-1).
How can I tell the dates are text?
They sit on the left of the cell, and the sort menu offers A to Z instead of Oldest to Newest.
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.