Modifying Default Year for Dates

Written by Allen Wyatt (last updated July 27, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003


2

When entering dates into a worksheet, Excel provides quite a bit of latitude for how you enter them. One area where latitude is granted is when it comes to including a year. If you include a year (such as 3/2/08), that is great. If you don't include a year (such as 3/2), then Excel helpfully adds the current year to what you are entering.

Most of the time this isn't a problem. It can be a problem, however, for those entering dates that "wrap around" to last year. For instance, many people enter dates for the previous month or two in their worksheets. In most months this isn't a problem, because the past month or two is in the same year as the current month. It can be a problem during January and February, however, when you may be entering dates from November and December of the previous year.

One solution is to always enter the year when entering a date. It is unarguably faster to leave the year off during data entry and allow Excel to add it to your entry. Thus, it would be nice to come up with a way to enter dates during the first two months of the year and have the previous year's year appended to them.

One way to handle this is to change the system date on your computer. Within Windows, decrement the system date by one year. Then, all dates that you enter will change to last year. This has ramifications in other programs, however, unless you remember to change the system date back. It also can mess up your data entry if, during the latter part of January and early February, you start entering dates from this year, and Excel automatically appends last year's year to them.

Doing anything more complex necessarily involves the use of a macro. Consider the following example, which should be added to the code window for a worksheet:

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub
    If Target = "" Then Exit Sub
    If Target.Column <> 1 Then Exit Sub

    If DateValue(Target) > Date Then
        Application.EnableEvents = False
            Target = DateAdd("yyyy", -1, Target)
        Application.EnableEvents = True
    End If
End Sub

This macro automatically runs whenever there is a change in the worksheet. If the change being made is to a single cell in column A, and what is being entered is a date that is greater than today's date, then a year is subtracted from what is being entered.

This works great, provided you are routinely entering dates that are within either the last year or the months so far in the current year. If you specifically add a far-future date (such as entering 6/11/17 on 3/2/16), then the year is still incremented by one. The macro could, of course, be modified to check to see if the date being entered is in the last two months of a year, and that the date is actually being entered during the first two months of a year, before doing the decrement of the year.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3360) applies to Microsoft Excel 97, 2000, 2002, and 2003.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Getting Rid of Cells Containing Only Spaces

If you have a worksheet that contains a bunch of cells that contain nothing but spaces, you may be looking for a way to ...

Discover More

Calculating an Age On a Given Date

Start putting dates in a worksheet (especially birthdates), and sooner or later you will need to calculate an age based ...

Discover More

Pasting Multiple Worksheets into a Word Document

Two very common programs that are used together are Excel and Word. If you want to copy multiple worksheets from an Excel ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (menu)

Entering Dates without Separators

When doing data entry into a worksheet, you might want to enter dates without the need to type the separators that are ...

Discover More

Recording a Data Entry Time

When entering information in a worksheet, it is common to also note a date or time corresponding to the entry. There are ...

Discover More

Jumping to the Start of the Next Data Entry Row

Want a quick way to jump to the end of your data entry area in a worksheet? The macro in this tip makes quick work of the ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two more than 7?

2016-03-02 12:18:49

Chris

Donna,

Did you find an answer for your question? I am having the same issue.


2016-01-26 22:49:40

Donna

"If you include a year (such as 3/2/08), that is great. If you don't include a year (such as 3/2), then Excel helpfully adds the current year to what you are entering." This helpful feature is not working in my application. I am using Excel 2016 and Windows 7 Pro. When I input a date e.g. "jan 26" with the following date format dd/mm/yyyy, Excel returns 01/01/2026. I am stumped as to why it's doing this. It doesn't matter if I use English or Canada. The date is correct in Windows. Any suggestions as I would prefer to not have to enter the year every time. Thx.


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.