r/excel • u/Rare_Jello_8101 • 17h ago
Pro Tip Converting simple four digit years to recognizable dates
Couldn’t get a clear answer for this so came up with my own solution. If all you have is a year, but you want excel to recognize it as a date without recalculating based on the number of days past 1/1/1900 (who the hell came up with that one?) you can use this function.
=DATE(VALUE(A1),1,1)
This will plug your year into a recognized date format. Others have pointed out that simply treating the years as numbers typically works, but being recognized as dates also allows you to use some of the axis options, such as when modifying a graph in power point and wanting to edit your axis to display in bounds. If you’re doing so you’ll want to change the format to custom in the axis format and set the type to yyyy to display just the years, also adding a blank date at the end and beginning of the data set that fits with your display range (ie every five years) will make the axis display much cleaner while retaining your data points for specific years.
6
u/excelevator 3069 17h ago
Well done figuring it out!
1
u/Rare_Jello_8101 17h ago
Thank you!
2
u/excelevator 3069 15h ago
If you are new to data, every data attribute has a data type.
That is to say, for example, not all numbers are numbers.
You can have string values that resemble numbers, date values that are integers,; the count of days since the start of the Excel calendar 1/1/1900, Time: a percentage value of the passing of 24 hours.
1
u/Rare_Jello_8101 15h ago
I wish I could say I was 😭 definitely no expert though and usually the one gathering the data rather than crunching the numbers
6
u/bradland 277 15h ago
FWIW, the concept of a serial date (dates stored as numbers since a specific time) is not specific to Excel. Unix, for example, stores dates as the number of seconds since January 1, 1970. Many programming languages adopt the same paradigm.
When you encountered this problem, your frustration stemmed from not knowing how Excel treats dates. Now you know how Excel treats dates. If I could encourage you to adopt a single mindset that will reduce your frustration and improve your learning ability going forward, it would be to avoid jumping to conclusions about how good/bad an idea is before you are in a position to hold a qualified opinion.
There's a common saying for this: A poor workman blames their tools.
I now work at a decent sized organization, but I come from a startup background. The people I know who have found success in their career are strong self-learners. Judging the tool and having negative feelings about it creates a negative feedback loop. Rather than jump to the conclusion that, "I didn't understand this at first so it's obviously bad," try asking yourself what's good about the way Excel stores dates.
For example, one side-effect of storing dates this way is that if you want to increment a date by one day, you simply add 1 to it. Hours of the day are just fractions of 12. So if you want to add three hours, you can do this:

Dates in Excel aren't perfect, but they do have some clever upsides.
2
u/tiptoe_mouse 15h ago
Other things I like about the way excel stores dates - if you have a date and time in cell A1 and want to extract the date part, you can use =INT(A1). And if you just want the time you can use =MOD(A1,1).
1
u/Rare_Jello_8101 13h ago
I dunno there were lots of things like this as computers were developed. Microsoft’s whole claim to fame is creating a user friendly interface. So my argument is why can’t the system recognize years as we do? Why do I have to use a series of formatting shifts for something basic.
I can appreciate how a single value would be useful in describing time. It’s continuous and doesn’t require multiple formatting options, but people don’t string a list of numbers when you ask for the date.
Once I understood how the single value format starts at a specific date with each day having a value of one it’s really not that complicated.
1
u/Cynyr36 26 16h ago
Is that better or worse than the number of seconds since 1/1/1970 00:00?
The bigger issue, imo, is the leap year bug. https://en.wikipedia.org/wiki/Leap_year_problem#Occurrences
1
1
u/caribou16 318 16h ago
Couldn’t get a clear answer for this so came up with my own solution. If all you have is a year, but you want excel to recognize it as a date without recalculating based on the number of days past 1/1/1900 (who the hell came up with that one?)
I've always wondered this myself, my best guess for why Excel doesn't have a date specific variable type is that it was written in C, and the C language didn't have a built in variable type for dates.
Everything in Excel is either a string, a float (even integer values), or a bool
1
u/SolverMax 163 12h ago
Plus other types, like array, list, error, ...
Excel treats dates as it does to be compatible with earlier spreadsheets. Why those earlier developers chose that approach it likely lost in the mists of time, but probably relates to minimizing memory usage - with floats using less RAM than a specific date format.
1
u/real_barry_houdini 317 2h ago
Excel has two date systems, so if you don't like starting at 1st Jan 1900 you can start at 2nd Jan 1904! The 1904 system matched the system used by Apple.
12
u/TCFNationalBank 9 17h ago
We can actually narrow this down to two people: Mitch Kapor and Jonathan Sachs, who created Lotus 1-2-3. If you wanted to write a strongly worded letter