11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

150<br />

Part II: Using Functions in Your <strong>Formula</strong>s<br />

A particularly useful custom number format for displaying times is<br />

[h]:mm:ss<br />

Using square brackets around the hour part of the format string causes Excel to display<br />

hours beyond 24 hours. You will find this useful when adding times that exceed 24<br />

hours. For an example, see the “Summing times that exceed 24 hours” section later in<br />

this chapter.<br />

Problems with dates<br />

Excel has some problems when it comes to dates. Many of these problems stem from the fact<br />

that Excel was designed many years ago, before the acronym Y2K became a household term.<br />

And, as I describe, the Excel designers basically emulated the Lotus 1-2-3 limited date and time<br />

features, which contain a nasty bug duplicated intentionally in Excel. In addition, versions of Excel<br />

show inconsistency in how they interpret a cell entry that has a two-digit year. And finally, how<br />

Excel interprets a date entry depends on your regional date settings.<br />

If Excel were being designed from scratch today, I’m sure it would be much more versatile in<br />

dealing with dates. Unfortunately, we’re currently stuck with a product that leaves much to be<br />

desired in the area of dates.<br />

The Excel leap year bug<br />

A leap year, which occurs every four years, contains an additional day (February 29). Specifically,<br />

years that are evenly divisible by 100 are not leap years, unless they are also evenly divisible by<br />

400. Although the year 1900 was not a leap year, Excel treats it as such. In other words, when<br />

you type the following into a cell, Excel does not complain. It interprets this as a valid date and<br />

assigns a serial number of 60:<br />

2/29/1900<br />

If you type the following invalid date, Excel correctly interprets it as a mistake and doesn’t convert<br />

it to a date. Rather, it simply makes the cell entry a text string:<br />

2/29/1901<br />

How can a product used daily by millions of people contain such an obvious bug? The answer is<br />

historical. The original version of Lotus 1-2-3 contained a bug that caused it to consider 1900 as a<br />

leap year. When Excel was released some time later, the designers knew of this bug and chose to<br />

reproduce it in Excel to maintain compatibility with Lotus worksheet files.<br />

Why does this bug still exist in later versions of Excel? Microsoft asserts that the disadvantages<br />

of correcting this bug outweigh the advantages. If the bug were eliminated, it would mess up

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

Saved successfully!

Ooh no, something went wrong!