Sheet Clinic

Google Sheets not sorting dates correctly: text and dd/mm dates

Dates sort out of order when some are text or were typed day first. Rebuild them with DATE in a helper column, then sort on that column.

Sheet Clinic editorsPublished
F2=SORT(HSTACK(D2:D9, B2:C9), 1, TRUE)

Before =SORT(A2:C9, 1, TRUE)

FGH
1Sorted by date
201/11/2026Olivia34
303/11/2026Jacob18
405/11/2026Megan27
509/11/2026Lauren48
612/10/2026Ryan50
717/10/2026Tyler21
828/10/2026Emily42
930/10/2026Sarah65

What changed

  1. D2 rebuilds the eight dates
  2. F2 sorts on column D

After sorted on real dates

FGH
1Sorted by real date
210/12/2026Ryan50
310/17/2026Tyler21
410/28/2026Emily42
510/30/2026Sarah65
611/1/2026Olivia34
711/3/2026Jacob18
811/5/2026Megan27
911/9/2026Lauren48
Figure 1. The same eight orders sorted twice. On the left, five wrong dates come first and three text cells trail behind. On the right, October 12 through November 9.

When Google Sheets is not sorting dates correctly and shows no error, check whether the cells are real dates. On the Broken tab below, three order dates are text, which SORT puts after every number, and five were typed day first, so this United States sheet swapped their month and day. Rebuilding each date with DATE in a helper column and sorting on that column put the list in order. A quick test for any date cell: unless someone changed the alignment, a real date sits against the right edge of the cell, and ISNUMBER returns TRUE for it.

Column F on the Broken tab shows eight orders sorted by date, and the order is wrong: it opens with 01/11/2026 for Olivia and closes with 30/10/2026 for Sarah. Five of the dates sit against the right edge of their cells and three sit against the left. The three on the left are text, and the other five are real dates with the month and day traded, because the list was written day first and this spreadsheet's locale, United States, reads dates month first.

On the Fixed tab, one formula in D2 swaps month and day back in the cells Sheets turned into dates and cuts the text cells into day, month and year. Then =SORT(HSTACK(D2:D9, B2:C9), 1, TRUE) in F2 sorts on the result, and the list runs from October 12 to November 9.

On the More date formats tab, DATEVALUE given a date written the same way, 25/10/2026, shows #VALUE! with this note: DATEVALUE parameter '25/10/2026' cannot be parsed to date/time.

The sort formula in F2 is =SORT(A2:C9, 1, TRUE), and nothing is wrong with it. What decides each cell is the first number of the entry. At 12 or less, Sheets takes it as the month and builds a real date. Over 12, no such month exists and the cell is kept as plain text. Google's DATEVALUE page says the formats Sheets understands "may depend on region and language settings," and its locale page says the locale sets the default date formatting for the whole spreadsheet (File, then Settings).

Day-first dates in a United States locale: 03/11 becomes March 11, 28/10 stays text

The take-home copy has the eight orders in A2:A9, typed exactly as a day-first list writes them. Sheets did not treat them alike. Cells A3, A5, A6, A7 and A9 (03/11, 05/11, 12/10, 01/11 and 09/11) are right-aligned. Those are numbers now, which is how Sheets stores a date. Cells A2, A4 and A8 (28/10, 30/10 and 17/10) are left-aligned text. Nothing else on screen marks the difference, and the right-aligned ones still display the digits as typed, so 03/11/2026 looks untouched even though Sheets has filed it under March.

That split explains the sort. SORT put the numbers first, in date order: January 11 (Olivia), March 11 (Jacob), May 11 (Megan), September 11 (Lauren) and December 10 (Ryan). The three text cells came after all of them, ordered by their characters, which means by the day: 17/10, 28/10, 30/10. Every row is in the wrong place, yet nothing shows an error.

Broken tab with A2 selected. The formula bar shows 28/10/2026. Column A mixes left-aligned and right-aligned dates, column F starts at 01/11/2026 for Olivia and ends at 30/10/2026 for Sarah, J2 shows 5 and J5 shows 46366.
Figure 2. The Broken tab. Left-aligned cells in column A are text.

Rebuilding real dates with DATE in a helper column, then sorting on it

The Fixed tab stops sorting on column A. Column A stays as it came in, so you can still see what the source said, and a new column D holds the real dates. One formula in D2 builds all of them:

=ARRAYFORMULA(TO_DATE(IF(ISNUMBER(A2:A9), DATE(YEAR(A2:A9), DAY(A2:A9), MONTH(A2:A9)), DATE(RIGHT(A2:A9, 4), MID(A2:A9, 4, 2), LEFT(A2:A9, 2)))))

ISNUMBER tells the stored dates from the text. For a cell Sheets already turned into a date, the month it holds is really the day and the day is really the month, so DATE(YEAR(A2:A9), DAY(A2:A9), MONTH(A2:A9)) swaps them back. For a text cell, the pieces are cut out of the string: the last four characters are the year, characters 4 and 5 are the month, the first two are the day. Those positions fit this list because every date in it has a two-digit day and a two-digit month.

The swap in D2 trusts that every row in column A was written day first. A row that was already month first, such as 11/09/2026 meant as November 9, would be swapped to September 11 with no error anywhere.

TO_DATE on the outside only changes the display. Without some date formatting, a formula result like this can show the raw serial number instead of a date, which is what happened in J5 on the Broken tab (more on that below). ARRAYFORMULA makes the one formula fill D2:D9.

Column D came back as 10/28/2026, 11/3/2026, 10/30/2026, 11/5/2026, 10/12/2026, 11/1/2026, 10/17/2026 and 11/9/2026, in the same row order as column A. Jacob's row is the one to look at: the source said 03/11/2026, Sheets had stored March 11, and D3 now shows 11/3/2026. Then =SORT(HSTACK(D2:D9, B2:C9), 1, TRUE) in F2 joins the new dates to the customer and amount columns and sorts on the first column. The list runs from Ryan on 10/12/2026 to Lauren on 11/9/2026.

With a longer list or one in other columns, A2:A9 changes to that date range everywhere it appears in the D2 formula. In the sort, D2:D9 is the helper column and B2:C9 is the rest of the table. Both formulas here stop at row 9. For a list that keeps growing, see the post on ARRAYFORMULA down a whole column, stopping at the last row.

Input8 day-first order dates in A2:A9, locale United States
Formula=SORT(HSTACK(D2:D9, B2:C9), 1, TRUE)
ExpectedRyan, Tyler, Emily, Sarah, Olivia, Jacob, Megan, Lauren
Sheets returnedRyan, Tyler, Emily, Sarah, Olivia, Jacob, Megan, Lauren Matches expected
Checked2026-11-11, free personal account

What the mix of text and flipped dates does to COUNT and MAX

Column J of the Broken tab shows what the same mix does to totals. =COUNT(A2:A9) returned 5 for eight orders, because COUNT only counts numbers and the three text dates are not numbers.

=MAX(A2:A9) returned 46366. That is a date serial, the number Sheets keeps behind a date, shown bare because the cell has no date format. The largest number in column A is Ryan's 12/10/2026, which Sheets stored as December 10, 2026. So the "latest order" in this sheet is a day in December that no order has, while the real latest order is Lauren's on November 9.

On the Fixed tab, =COUNT(D2:D9) returned 8 and =TO_DATE(MAX(D2:D9)) returned 11/9/2026. The TO_DATE wrapper is what turns the serial into a readable date in that cell.

DATEVALUE tested on six date formats, and why it misses flipped dates

The More date formats tab tries six entries in column A, says in column B how each one was typed, and runs =ISNUMBER(A2) and =DATEVALUE(A2) on each. The results, row by row:

  • Row 2, '11/03/2026 typed with a leading apostrophe. The apostrophe keeps it as text, so ISNUMBER is FALSE, but the order is month first and DATEVALUE returned 46329, which is November 3, 2026.
  • Row 3, 25/10/2026. Text, ISNUMBER FALSE, and DATEVALUE gave #VALUE! with the note quoted at the top of this page.
  • Row 4, 03/11/2026. ISNUMBER TRUE. DATEVALUE returned 46092, which is March 11. The help page says a number or a reference to a number gives #VALUE!, but in this copy it passed the stored date through without complaint.
  • Row 5, 2026-10-25, and row 6, Oct 25, 2026. Both became dates on entry, ISNUMBER TRUE, and both returned 46320. A year-first date or a written month leaves nothing to guess.
  • Row 7, 25.10.2026 with dots. Text, ISNUMBER FALSE, DATEVALUE #VALUE!.

Two things follow from that list. DATEVALUE fixes text dates only when they are already in the order the locale expects, as row 2 shows. And it never flags a date that was read the wrong way round, as row 4 shows, so an error-free DATEVALUE column proves nothing about day-first data. For a list that came in day first, pulling the pieces apart with DATE, as column D on the Fixed tab does, is the dependable route.

More date formats tab with D3 selected. The formula bar shows =DATEVALUE(A3), D3 shows #VALUE!, and the note reads: Error DATEVALUE parameter '25/10/2026' cannot be parsed to date/time.
Figure 3. Row 3 of the More date formats tab. DATEVALUE rejects a day-first date when the day is over 12.

Entering the DATE and SORT formulas on the Try it yourself tab

On the Try it yourself tab the sort in column F is still wrong, and two cells change:

  1. Click D2, which is empty, and enter the formula from the Fixed tab: =ARRAYFORMULA(TO_DATE(IF(ISNUMBER(A2:A9), DATE(YEAR(A2:A9), DAY(A2:A9), MONTH(A2:A9)), DATE(RIGHT(A2:A9, 4), MID(A2:A9, 4, 2), LEFT(A2:A9, 2)))))
  2. Click F2, delete =SORT(A2:C9, 1, TRUE), and enter =SORT(HSTACK(D2:D9, B2:C9), 1, TRUE)

F2:H9 should then match F2:H9 on the Fixed tab, Ryan at the top and Lauren at the bottom. The order dates in column A don't move, and they shouldn't: column D reads them, and the swap only gives the right answer while column A still holds the original entries.

Fixed tab with D2 selected. The formula bar shows =ARRAYFORMULA(TO_DATE(IF(ISNUMBER(A2:A9), DATE(YEAR(A2:A9), DAY(A2:A9), MONTH(A2:A9)), ... Column D shows 10/28/2026 down to 11/9/2026, column F is sorted from 10/12/2026 to 11/9/2026, J2 shows 8 and J5 shows 11/9/2026.
Figure 4. The Fixed tab. Column A is unchanged; D and F carry the real dates.

Take-home copy. Four tabs: Broken (as you see it), Fixed, Try it yourself, More date formats. It opens as a copy in your own Drive.

Copy the sheet