Answers to frequently asked questions about Excel date and time calculations
For 2 cells with times, just add together like any number (=A1+A2+A3).
To add 8 hours to the time in a cell, use this formula: =B2 + 8/24
NOTE: Use custom number format [h]:mm in the result cell to prevent rollover at 24 hours (see the screen shot in question "When I try to sum the time data..." below.)
For 2 cells with times, just subtract, like =B1-A1.
To subtract 3 hours from the time in a cell, use this formula: =B2 - 3/24
NOTE: Use Calendar format 1904 if you need to display negative results; Tools/Options/Calculation and check the 1904 Date System checkbox. Note that 1904 calendar will offset all dates by 4 years 1 day, so be careful.
Use the custom number format [h]:mm to prevent rollover at 24 hours
Since XL stores times as fractions of days, in order to convert integers into times you need to divide the sum by (24*60*60) or 86,400
1 is a day; 24 hours. So one hour is 1/24. =A1*B1*24 will bring the desired result. Format result cell as currency or number (it tends to pick the date format by default).
If the start time is greater than the end time, we'll assume that
the shift ended the next day. In that case, we'll add 1 to the end time,
which is the equivalent of adding a full day to the end time. That makes
the end time greater than the start time, and the calculation will work
For example, with start time in cell B2 and end time in cell C2, use this formula:
To enter the current date, press Ctrl + ;
(hold the Ctrl key while typing a semicolon.)
To enter the current time, press Ctrl + : (hold the Ctrl key while typing a colon.)
One workbook is using 1904 calendar, the other one 1900 (in the first example, years are not displayed, but definitely present). Go menu Tools>Options, Calculation and make them equal, preferably also correct if you know what the dates was supposed to be.
The last day of the month equals the zero'th of next month for some strange reason: =DATE(YEAR(A1),MONTH(A1)+1,0)
Yes it does and it's not. The following MSKB article explains the reason:
Excel incorrectly assumes that the year 1900 is a leap year
Chip Pearson's web page on dates and times will give you an understanding of how this works in Excel , and it has lots of useful date and time samples.
Credits: Original FAQs compiled by Harald Staff, Excel MVP 2000-2005. Additions by Debra Dalgleish.
Last updated: March 5, 2020 2:45 PM
Contextures RSS Feed