# Why are my dates not sorting correctly in Excel?

The dates are text, so they sort character by character. Sort by the converted dates: =SORTBY(A2:C8,DATEVALUE(A2:A8)).

**Excel:** `=SORTBY(A2:C8,DATEVALUE(A2:A8))` (Excel 2021, 2024 and Microsoft 365)

**Google Sheets:** `=SORT(A2:C8,ARRAYFORMULA(DATEVALUE(A2:A8)),TRUE)`

## Example

Sample data (row 1 is the header):

| A | B | C | D | E |
| --- | --- | --- | --- | --- |
| Date | Order | Amount |  | Sorted by real date |
| 10/2/2026 | SO-114 | 420 |  |  |
| 2/15/2026 | SO-102 | 185 |  |  |
| 9/30/2026 | SO-113 | 960 |  |  |
| 12/1/2025 | SO-098 | 310 |  |  |
| 1/7/2026 | SO-100 | 75 |  |  |
| 11/18/2025 | SO-095 | 540 |  |  |
| 3/3/2026 | SO-104 | 265 |  |  |

Formula in E2: `=SORTBY(A2:C8,DATEVALUE(A2:A8))`

Result (spills 7 × 3): 11/18/2025, SO-095, 540; 12/1/2025, SO-098, 310; 1/7/2026, SO-100, 75; 2/15/2026, SO-102, 185; 3/3/2026, SO-104, 265; 9/30/2026, SO-113, 960; 10/2/2026, SO-114, 420

## 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.

## Other ways

- `=SORTBY(A2:C8,--A2:A8)`: 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.

## 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.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/dates-not-sorting-correctly
