Can't Enter Years in a Cell

Written by Allen Wyatt (last updated June 24, 2025)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and 2021


1

Laurie has a column that she formatted using "yyyy" as a custom format. (She wants it to contain years.) However, when she starts typing years into the column, she doesn't get what she expect. For instance, when she enters 2020 Excel converts the number to 1909. Laurie wonders why this is happening.

It is happening because of the expectations that you set for Excel. When you formatted the column using the "yyyy" custom format, you informed Excel that you wanted whatever was in the column to be considered a date. Yet, you didn't enter a date into the cells—you entered a simple numeric value of 2020. A date would be something such as 1/1/2020 or 1/1/20; these would display the year just fine because they are dates, as Excel expects.

So why does entering just 2020 cause 1909 to be displayed? Because Excel, in trying to make sense of the entry as a date, assumes you are entering a number of days. Internally, dates are stored as a serial number that indicates the number of days since 1/1/1900, with 1 representing 1/1/1900, 2 representing 1/2/1900, 3 representing 1/3/1900, and so on.

It just so happens that the number 2020 represents the date 7/13/1909 (July 13, 1909), which your formatting says should be displayed as simply 1909—the year portion of that valid date. In fact, you can see that date if you select the cell again after trying to enter 2020. Up in the formula bar you'll see how Excel converted your entry into a valid date.

The solution depends on what you want to do with the information in the column. If you simply want to enter a bunch of years, don't format the column as dates. The General format or some other numeric format will work just fine. If, instead, you want actual dates, then you'll need to enter them as such: 1/1/2020, etc.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10161) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and 2021.

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

Two Page Numbers per Physical Page

If your document has two mini pages on one page, inserting page numbers in Word, so that each mini page has its own ...

Discover More

Scrolling Text Sideways

Most people use the mouse wheel to scroll their document up and down. What if it starts scrolling left and right, ...

Discover More

Understanding Leading

Those with a publishing, typographic, or design background may understand what leading is, but not how to adjust the ...

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 (ribbon)

Splitting Information into Rows

Got too much information in a single cell? Here's how you can use a macro to pull apart that information and put it into ...

Discover More

Removing Spaces around Dashes

A common editing task with Excel data is to remove spaces that may surround dashes within text. This tip presents several ...

Discover More

Adding Spaces in Front of Capital Letters

Got some text that is "run together" and needs spaces inserted to improve readability? There are a variety of approaches ...

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 9 + 6?

2025-06-24 06:21:37

jamies

Basic start for designing an App or process is
If you will be doing arithmetic on it, it's probably to be stored as a "Number"
and "hinting" to Excel that th data input is to be considered as a "General" entry means that you want Excel to decide what you want the entry to be processed as.

If you will not be doing "arithmetic" on it, you should ensure the entry is treated as "Text"
either by setting that format, and managing to stop the user pasting into that cell -
they should use paste special Values, or in VBA use .Value2 note - using .Value ( or letting excel assume what part of the cell attribute is to be pasted can have Excel treat the "value as a date, or currency -
so - is that ddmmyyyy, or mmddyyyy format, or interpret a 2 digit yy entry according to the MS settings for the number to be 20th century or 21st century -
as in 99 will be 1999, and 00 will be 2000 with the split point possibly being 35
and the currency assumption - round to 2 decimal places with VBA alternate up, or down of .005 - Bankers rounding,
and the numeric entry being preceded with a "$", so it is actually a text string in the cell, not a numeric value !

Some tweaks VBA check cell selection and then stop the paste of formatting - real heavy thinking as to what cells to process and how,

and - precede the value with an apostrophe to get Excel to treat the entry as a text string
And if setting a value using an IF function -
append the value to a ""& string -
that stops a void entry showing as 0 rather than nothing.
=if(len(cell)<1,,""&cell) will show a 0 if the cell is empty is and otherwise set the result as a text string

So - back to the 2020 entry

As Allen stated.
The solution depends on what you want to do with the information in the column.

And also - how you can process the entry
The old Excel 4.0 macros, also known as XLM macros, are a legacy macro language in Excel predating VBA, and,
if you can get the excel setup to allow them ( settings) will allow you to check the actual data the user was entering into the cell -
as in 1/2 being processed as 1 then / then 2 then being "entered " so you can treat that as d/m or as a fraction giving 0.5
remembering that fractions may be held as floating point in powers of 2
so 1/2 is exactly 2^-1 and 1/5 expected to be 0.2 is a value with a minute difference from from the expectation -
so consider that "annoyance" when testing for specific values including 0
use a test something like
=if(abs(wantedvalue-variable)<0.0000000000001,"nearenough", too different")


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu 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.