How to sort dates automatically upon entry or change in Excel?
In Excel, the Sort function can help you to sort date in ascending or descending order as you need. But it isn’t dynamic, if you have sorted the date and then add new date to it, you would need to sort it again. Are there any good and quick ways to auto-sort dates when entering new data each time in a worksheet?
Auto sort date when date is entered or changed with formula
Auto sort date when date is entered or changed with VBA code
Auto sort date when date is entered or changed with formula
For example, if the original dates are in Column A, the following formula can help you auto-sort the dates or any other text strings into a new helper column based on the column you want to sort. Please follow these steps:
1. Enter this formula:
=INDEX($A$2:$A$15,MATCH(ROWS($A$2:A2),COUNTIF($A$2:$A$15,"<="&$A$2:$A$15),0)) into a blank cell beside your date column, C2, for example, and then press Ctrl + Shift + Enter keys together to get a number sequence. Next, drag the fill handle down to the desired cells. See screenshot:
Note: In above formula: A2:A15 is your original date range that you want to auto sort.
2. Then format the numbers as date format by clicking Short Date from the General drop down list under the Home tab, see screenshot:
3. The sequence numbers are now converted to date format, and the original dates have been sorted as well. See screenshot:
4. From now on, when you enter or change a date in column A, the dates in column C will be sorted in ascending order automatically. See screenshot:
Auto sort date when date is entered or changed with VBA code
The following VBA code can help you auto-sort dates in the original column when you enter or change a date as needed.
1. Go the worksheet that you want to auto sort the date when you enter or change a date.
2. Right click the sheet tab, and select View Code from the context menu, in the popped out Microsoft Visual Basic for Applications window, please copy and paste the following code into the blank Module window, see screenshot:
VBA code: auto sort when date is entered or changed:
Private Sub Worksheet_Change(ByVal Target As Range)
'Updateby Extendoffice
On Error Resume Next
If Application.Intersect(Target, Application.Columns(1)) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
Range("A1").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub
Note: In the above code, the entered dates will be auto-sorted in column A. You can change A1 and A2 to your own cells as you need.
3. From now on, when you enter a date in column A, the dates will be sorted in ascending order automatically.
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
All Kutools add-ins. One installer
Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.





- All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
- One installer, one license — set up in minutes (MSI-ready)
- Works better together — streamlined productivity across Office apps
- 30-day full-featured trial — no registration, no credit card
- Best value — save vs buying individual add-in