11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 6: Working with Dates and Times 151<br />

hundreds of thousands of existing workbooks. In addition, correcting this problem would affect<br />

compatibility between Excel and other programs that use dates. As it stands, this bug really<br />

causes very few problems because most users do not use dates before March 1, 1900.<br />

Pre-1900 dates<br />

The world, of course, didn’t begin on January 1, 1900. People who work with historical information<br />

using Excel often need to work with dates before January 1, 1900. Unfortunately, the only<br />

way to work with pre-1900 dates is to enter the date into a cell as text. For example, you can<br />

type the following into a cell, and Excel won’t complain:<br />

July 4, 1776<br />

If you plan to sort information by old dates entered as text, you should enter your text<br />

dates with a four-digit year, followed by a two-digit month, and then a two-digit day —<br />

like this: 1776-07-04. This format will enable accurate sorting.<br />

You can’t, however, perform any manipulation on dates recognized as text. For example, you<br />

can’t change its numeric formatting, you can’t determine which day of the week this date<br />

occurred on, and you can’t calculate the date that occurs seven days later.<br />

In Chapter 25, I present some custom VBA functions that enable you to work with any<br />

date in the years 0100 through 9999.<br />

Inconsistent date entries<br />

You need to exercise caution when entering dates by using two digits for the year. When you do<br />

so, Excel has some rules that kick in to determine which century to use. And those rules vary,<br />

depending on the version of Excel that you use.<br />

Two-digit years between 00 and 29 are interpreted as 21st century dates, and two-digit years<br />

between 30 and 99 are interpreted as 20th century dates. For example, if you enter 12/15/28,<br />

Excel interprets your entry as December 15, 2028. However, if you enter 12/15/30, Excel sees it as<br />

December 15, 1930, because Windows uses a default boundary year of 2029. You can keep the<br />

default as is or change it by using the Windows Control Panel. Display the Regional and<br />

Language Options dialog box. Then click the Customize button to display the Customize Regional<br />

Options dialog box. Select the Date tab and then specify a different year.<br />

The best way to avoid any surprises is to simply enter all years using all four digits for<br />

the year.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!