Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: How Excel Stores Dates and Times.
Written by Allen Wyatt (last updated January 25, 2022)
This tip applies to Excel 97, 2000, 2002, and 2003
Internally, Excel stores a date or time as a number. The whole part of the number (the part to the left of the decimal point) represents the number of days since an arbitrary starting point (typically January 1, 1900). The decimal portion (the part to the right of the decimal point) represents the time for that date. These internal representations of dates and times are often referred to as serial numbers.
To see how this works, enter the number 23 in a cell. If you have not previously formatted the cell, Excel uses the General format, displaying the number simply as 23. If you later format this cell using a date format—m/d/yy, for instance—Excel changes the display to 1/23/00, or January 23, 1900.
The portion to the right of the decimal point represents a fractional portion of a day. Thus, a single second would be equal to approximately 0.00001157407, since that is equal to 1 (a day) divided by 86,400 (the number of seconds in a day).
Since Excel stores dates and times as serial numbers, you can do math on them. For instance, if you wanted to determine the number of days between two dates, or the amount of time between two times, simply subtract them from each other. The result is the number of days and fractions of days between the two.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2176) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: How Excel Stores Dates and Times.
Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!
When working with dates, it is often helpful to be able to calculate some date in the future based on a starting date. ...
Discover MoreExcel makes it easy to import information created in other programs. Converting the imported data into something you can ...
Discover MoreExcel allows you to store dates in a cell. Wouldn't it be great if you could select a cell containing a date and then ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2022-03-29 22:35:01
Peter
Hi Tim
If you just want to deal with clock time in your example, you need to discard the integer number of days to the left of the decimal point. Otherwise you are dividing (1+0.77791203703704) by 3 and will get the expected answer 0.592637346 or 2:13:24 PM.
You can get the fractional part representing clock time by using one of the expressions MOD(A1,1) or A1-INT(A1)
You have also discovered that day 1 of the Excel calendar is 1/1/1900. Day 0 is 0/1/1900.
So the formula bar was correctly showing a date-time value of 1 day, 18h, 40min, 12 sec albeit as 1/01/1900 6:40:12 PM
2022-03-28 17:39:47
Tim
if this is all true, then explain why one cannot simply divide a time and get the correct results? for example, a time is stored in cell a1 with a value of 1.77791203703704. formatting that to hh:mm yields 18:40, with the formula field showing 1/1/1900 6:40:12 PM. Dividing the value by 6, i would expect to see 3:06, but instead i see 7:42.
I can get to the correct 3:06 by using the equation "=((hour(a1)*3600+minute(a1)*60+second(a1))/6)/86400", (convert time to number of seconds), divide by 6, then convert back to fraction of a day. but why can i not just divide the fraction of the day by 6 and get the same results? I know I'm missing something!
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments