Microsoft Office Tutorials and References
In Depth Information
Chapter 6: Working with Dates and Times
hundreds of thousands of existing workbooks. In addition, correcting this problem would affect
compatibility between Excel and other programs that use dates. As it stands, this bug really
causes very few problems because most users do not use dates before March 1, 1900.
Pre-1900 dates
The world, of course, didn’t begin on January 1, 1900. People who work with historical
information using Excel often need to work with dates before January 1, 1900. Unfortunately, the only
way to work with pre-1900 dates is to enter the date into a cell as text. For example, you can
type the following into a cell, and Excel won’t complain:
July 4, 1776
If you plan to sort information by old dates entered as text, you should enter your text
dates with a four-digit year, followed by a two-digit month, and then a two-digit day —
like this: 1776-07-04. This format will enable accurate sorting.
You can’t, however, perform any manipulation on dates recognized as text. For example, you
can’t change its numeric formatting, you can’t determine which day of the week this date
occurred on, and you can’t calculate the date that occurs seven days later.
In Chapter 25, I present some custom VBA functions that enable you to work with any
date in the years 0100 through 9999.
Inconsistent date entries
You need to exercise caution when entering dates by using two digits for the year. When you do
so, Excel has some rules that kick in to determine which century to use. And those rules vary,
depending on the version of Excel that you use.
Two-digit years between 00 and 29 are interpreted as 21st century dates, and two-digit years
between 30 and 99 are interpreted as 20th century dates. For example, if you enter 12/15/28,
Excel interprets your entry as December 15, 2028. However, if you enter 12/15/30, Excel sees it as
December 15, 1930, because Windows uses a default boundary year of 2029. You can keep the
default as is or change it by using the Windows Control Panel. Display the Regional and
Language Options dialog box. Then click the Customize button to display the Customize Regional
Options dialog box. Select the Date tab and then specify a different year.
The best way to avoid any surprises is to simply enter all years using all four digits for
the year.
 
Search JabSto ::




Custom Search