Written by Allen Wyatt (last updated June 24, 2025)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and 2021
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.
Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2019 For Dummies today!
We all make mistakes. Fortunately, Excel makes it rather easy to undo your makes, right after you make them.
Discover MoreEnter some data in a cell, and Excel typically moves to the next cell when you press Enter. If you want to move more than ...
Discover MoreWant to select all the data in a contiguous section of a worksheet? The shortcut discussed in this tip makes it very easy.
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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")
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments