Home life · Updated
How to Organize Data by Date in Excel
Quick answer To organize data by date in Excel, select your data, open the Sort dialog, choose the date column, and sort oldest to newest or newest to oldest. This works for dates stored as text if you convert them first.
What You’ll Need
- A computer with Microsoft Excel (2016 or later, or Excel for Microsoft 365).
- A spreadsheet containing a column with dates (or text that looks like dates, e.g., “2023-05-01”).
- Basic familiarity with selecting cells and using the ribbon menu.
Step-by-Step
- Check your date column. Look at the cells in your date column. If they are left-aligned, they are likely text, not real dates. Real dates in Excel are right-aligned by default. If you see left-aligned dates, you’ll need to convert them (see Step 2). If they are right-aligned, skip to Step 3.
- Convert text dates to real dates. Select the column with the dates. Go to the Data tab and click Text to Columns. In the wizard, choose Delimited, click Next, uncheck all delimiters (like Tab or Comma), click Next, and under Column data format select Date and choose the format that matches your data (e.g., MDY for month-day-year). Click Finish. Now the dates should be right-aligned. If they still don’t look right, try using the DATEVALUE function in a new column: type
=DATEVALUE(A2)(replace A2 with your first date cell) and drag down. Then copy the new column and paste as values over the original. - Select your entire data range. Click and drag to select all the rows and columns you want to sort. Include the header row if you have one. Do not select just the date column—this would sort only that column and scramble your data.
- Open the Sort dialog. Go to the Data tab on the ribbon. In the Sort & Filter group, click Sort. A dialog box will appear. If you have a header row, make sure the My data has headers checkbox is ticked.
- Choose the date column and order. In the Sort by dropdown, select the column that contains your dates. In the Sort On dropdown, keep Cell Values. In the Order dropdown, choose Oldest to Newest (ascending) or Newest to Oldest (descending). Click OK. Your data will now be sorted by date.
- Verify the result. Scroll through your data to confirm that the dates are in the correct order and that the rows are intact (i.e., the values in other columns moved with their dates). If something looks off, press Ctrl+Z to undo and re-check your selection.
Common Mistakes
- Sorting only the date column. This is the most common error. It leaves the rest of your data in the original order, breaking the relationship between rows. Always select the full range of data.
- Forgetting to convert text dates. If your dates are text, Excel sorts them alphabetically, not chronologically. For example, “10/01/2023” would come before “09/01/2023” because “1” is less than “9”. Convert them first.
- Including hidden rows or filters. If you have filters applied, sorting may only affect visible rows. Clear any filters before sorting.
- Using the wrong date format. If your dates are in a format Excel doesn’t recognize (e.g., “2023-05-01” as text), the Text to Columns method may not work. Use the DATEVALUE function or the Find & Replace trick (replace “.” with “/” if needed).
Tips
- Use a Table. Convert your data range to an Excel Table (select the range, press Ctrl+T). Then you can use the filter arrows in the header to sort by date easily, and the table will keep rows together automatically.
- Sort by multiple columns. In the Sort dialog, click Add Level to sort by date first, then by another column (e.g., time or category) within each date.
- Use the SORT function. If you want a dynamic sorted list that updates automatically, use
=SORT(A2:D100, 2, 1)where 2 is the column number of the date and 1 means ascending. This works in Excel 365 and Excel 2021. - Format dates consistently. After sorting, select the date column, right-click, choose Format Cells, and pick a date format that suits your needs (e.g., “14-Mar-2023” or “March 14, 2023”).
Troubleshooting
- Dates are still out of order after sorting. This usually means some cells are text and some are real dates. Apply the conversion in Step 2 to the entire column. Also check for leading or trailing spaces—use
=TRIM(A2)to remove them. - Excel says “Different types of data” warning. This appears when your column has mixed formats (e.g., some text, some numbers). Convert all to dates first, then sort again.
- Sorting changes the entire row order incorrectly. Undo (Ctrl+Z), then re-select your data. Ensure you included all columns and that there are no blank rows or columns in your selection.
- Dates appear as numbers like 45000. This means the cell is formatted as a number but contains a date serial. Select the cells, press Ctrl+1, and choose a date format under the Number tab.
- Sort option is greyed out. This can happen if your worksheet is protected. Go to Review > Unprotect Sheet (if you have the password) or ensure you are not in a shared workbook mode.
Frequently Asked Questions
Why does Excel sort dates as if they were text?
Excel treats cells as text if they are not recognized as dates. This often happens when the date is entered with periods (e.g., 2023.05.01) or when the system’s date format doesn’t match the data. Convert text to dates using Text to Columns or DATEVALUE.
Can I sort by date without selecting the whole table?
Yes, but you must select the entire range of data, not just the date column. If you only select the date column, Excel will sort that column alone and destroy the row relationships. To avoid this, use a Table or select all columns.
How do I sort by month and day, ignoring the year?
You can add a helper column with the formula =TEXT(A2,"MMDD") to extract the month and day, then sort by that helper column. Alternatively, use the Sort dialog and choose Month under Sort On if your dates are real dates.
What if my dates are in the format “May 1, 2023”?
That is a text format. Use Text to Columns and select the Date option with the appropriate format (e.g., MDY). Or use the DATEVALUE function: =DATEVALUE("May 1, 2023") returns a real date.
How do I sort by date in Excel Online?
Excel Online works similarly. Select your data, go to the Data tab, and use the Sort option. You can also use the filter arrows if your data is in a Table. The steps are the same as desktop Excel.
Can I sort by date automatically when I add new rows?
Yes, by converting your data to an Excel Table (Ctrl+T) and then sorting, new rows added to the table will be included in the sort range. However, you’ll need to re-sort after adding rows, or use the SORT function for a dynamic range.
Related
- How to Write a D&D Campaign: Step-by-Step Guide
- How to Remove Stains from an Iron Soleplate
- How to Phone Barclays: UK Customer Service Numbers
Sources: Microsoft Support. Menus and buttons can differ slightly by version. Spotted something out of date? Tell us.