To sort by date in Excel Online (Excel for the web), click a cell in the date column, go to the Data tab, and click Sort Ascending for earliest to latest or Sort Descending for latest to earliest. Excel moves each whole row along with its date. In the Windows desktop app, the same buttons are labeled Sort Oldest to Newest and Sort Newest to Oldest.
These steps cover Excel for the web in a current browser (opened from office.com, OneDrive or SharePoint) and Excel for Microsoft 365, Excel 2024 and Excel 2021 on Windows. The text-date fixes come from Microsoft’s Convert dates stored as text to dates, and the sort-order rules from its older Sort data in a workbook in the browser page.
Before you sort
- You need edit access. If the workbook was shared as view-only, or the upper-right corner says Viewing, switch to Editing or ask the owner for edit rights.
- Keep the data in one block. Each row should be one record, with no fully empty rows or columns inside it. Excel uses the surrounding block of filled cells to decide what to sort, so a blank column can cut off the data on the other side of it.
- Unhide hidden rows and columns. Microsoft says hidden rows and columns don’t move during a sort, so they can end up next to the wrong records.
- Check that the dates are real dates. A real date is stored as a number (a date serial number) and sits on the right side of the cell by default. If your dates are on the left, read the text-date section below first. A date column built with the fill handle holds real dates, and filling dates automatically in Excel shows how to create one.
How to sort by date in Excel Online
- Open your workbook in Excel for the web.
- Click a cell in the date column. If your data has a header row, you can pick the header cell instead.
- Go to the Data tab.
- Click Sort Ascending (earliest to latest date) or Sort Descending (latest to earliest date).

The rows are reordered by date, and the other columns in each row move with their dates. Excel for the web saves the change automatically. To put the rows back, click Undo on the Home tab or press Ctrl+Z (Command+Z on a Mac) right away.
To confirm it worked, look at the first and last rows. With Sort Ascending, the oldest date should be at the top. If a date from the wrong year or month appears out of place, that cell is probably text.
Sort Dates in Desktop Excel
Save a copy first if the worksheet contains important records.
- Select a cell in the date column within the complete list. Keep names, dates and other related fields together.
- Open Data and select Sort Oldest to Newest or Sort Newest to Oldest.
- If Excel asks which cells to sort, choose Expand the selection so the other columns move with their dates.
- Check the first and last records. If the order is wrong, undo the sort and use the text-date fixes below.
Be careful with step 3. Continue with the current selection sorts only the cells you highlighted, which separates dates from the names or amounts on their rows. If that happens, undo right away.
If your data is formatted as an Excel table, each column header has a filter button. Select the filter button on the date column and pick the sort order you want. If your data isn’t a table yet, formatting it as one adds those buttons automatically. To add sort arrows to the header row of any list, see how to make sortable headings in Excel.
A table also keeps its rows together when you sort, which makes it a safer choice for lists that you sort often.
How to sort by date and another column
- Select any cell in your data.
- On the Data tab, select Custom Sort.
- Under Sort by, choose the first column, and under Order choose Sort Ascending or Sort Descending.
- Select Add to add another column, and set its order.
- Use the Up or Down arrows to change which column sorts first, then confirm.
Excel sorts by the first column, then by the next one within each group. The Sort On menu (for sorting by color) isn’t supported in Excel for the web yet, so use the desktop app for that. In the desktop app, the button for a new level is called Add Level, and the date order choices are Oldest to Newest and Newest to Oldest. You can sort by up to 64 columns.
For example, to list each customer’s orders with the newest first, sort by Customer (A to Z) and then by Order Date (newest first).
If the first row holds column names, check the headers box in the dialog (My data has headers in desktop Excel) so the header row stays at the top.
If your list has product photos, insert each picture into a cell first so the photos move with their rows when you sort.
Sort by month, day or weekday
A normal date sort orders by year, then month, then day. For birthdays, anniversaries or renewals, you usually want to ignore the year. Add a helper column next to your data, fill it with a formula, and sort by that column instead. These formulas assume the first date is in cell B2; change B2 to match your sheet.
| To sort by | Helper formula | What it returns |
|---|---|---|
| Month only | =MONTH(B2) | 1 for January through 12 for December |
| Month and day (birthday order) | =TEXT(B2,”mm.dd”) | Text like 03.14 that sorts in calendar order |
| Day of the week | =WEEKDAY(B2) | 1 for Sunday through 7 for Saturday |
| Year only | =YEAR(B2) | The four-digit year |
- In the first empty column to the right of your data, type a header such as Month in row 1.
- Type the formula in row 2 and press Enter.
- Drag the fill handle (the small square at the bottom-right corner of the cell) down to the last row.
- Click a cell in the helper column and use Sort Ascending.

Rows in the same month stay in their previous order when you sort by month only, so use the month-and-day formula when the day matters. You can delete or hide the helper column afterward.
Why won’t my dates sort correctly?
Dates must be stored as date serial numbers to sort correctly; if Excel doesn’t recognize a value as a date, it’s stored as text and sorts out of order. Text dates usually sit left-aligned in the cell instead of right-aligned.
Two other signs point to text dates: the desktop sort buttons say Sort A to Z instead of Sort Oldest to Newest, or =ISNUMBER(B2) returns FALSE for a cell that looks like a date. Changing the number format to a date does not fix text, because the value underneath is still text.
- Convert with DATEVALUE: in a blank cell with General format, enter =DATEVALUE(, select the text date, type ), and press Enter. Copy the results back over the text dates with Paste Special and apply a date format.
- Two-digit years: in the desktop app, select cells with the green error triangle, click the error button, and choose Convert XX to 20XX or Convert XX to 19XX.
- Blank cells and spaces: in a browser sort, blank cells always go last, and values with leading spaces sort before everything else.
- Day and month swapped: dates such as 13/02/2026 come from systems that write the day first. On a US system, Excel can’t read them as dates. In desktop Excel, select the column, choose Data > Text to Columns, click Next twice, pick Date with DMY, and click Finish.
- Times attached to dates: a date with a time sorts by both. If you only care about the day, add a helper column with =INT(B2), format it as a date, and sort by it.

If Excel keeps turning other entries into dates when you type them, read about why Excel keeps changing numbers to dates.
Keep a sorted copy with a formula
The Sort buttons change the order of the original rows. If you’d rather leave the source list alone, the SORTBY function builds a sorted copy that updates when the data changes. It works in Excel for Microsoft 365, Excel 2024 and Excel 2021, plus the Excel mobile apps.
For data in A2:D100 with dates in column C, type =SORTBY(A2:D100,C2:C100,1) in an empty cell with room below and to the right. Use -1 instead of 1 for newest first. The results spill into the cells below, so keep that area empty.
Excel Online Sorting Questions
Can I sort by day of the week instead?
You can format the cells to show the day of the week. To sort by weekday regardless of the date, one approach is to convert the dates to text with the TEXT function, but the result then sorts alphabetically, not by date. The =WEEKDAY(B2) helper column above gives Sunday through Saturday order instead.
Does sorting change my dates?
No. Sorting reorders rows; the date values stay the same. Use Undo on the Home tab if you don’t like the result.
Why does my header row end up in the middle of the data?
Excel treated the header as data. Undo the sort, open Custom Sort, and check the box that says your list has headers before you sort again.
Will other people see the new order?
Yes. In a shared workbook, sorting changes the row order for everyone. If coworkers want their own order, filter or sort in a table instead, or make a copy.
How do I keep the newest record when removing duplicates?
Sort the table newest to oldest first, then remove duplicates in Excel. Excel keeps the first copy it finds.
For faster date entry before you sort, you can add a pop-up calendar to a cell in Excel.
More Excel Guides
- How to hide columns in Excel Online
- How to calculate age and date differences in Excel
- How to download a copy of an Excel Online file

Matthew Burleigh is the founder, head writer, and editor of Solve Your Tech, which he launched in 2012. He has written technology tutorials since 2008 and worked in IT since 2003, including small-business support, IT management, and consulting. He holds Bachelor’s and Master’s degrees in Computer Science from Arizona State University.
Matthew writes practical guides for Windows, iPhone and iPad, Microsoft Office, Outlook, Google apps, and Android. Solve Your Tech’s guides are checked step by step against the device or app maker’s own documentation and tested on his own devices whenever he has the hardware or software, with clear steps, sources, and update dates.
Read more about Matthew and how Solve Your Tech writes and updates its guides, or report a correction.