Archive of Mr Excel Message Board


Back to Forms in Excel VBA archive index
Back to archive home

Calculating date and time events

Posted by Mike on December 31, 2001 6:56 AM
have not been successful getting excel to calculate the time between two events. example 12/31/2001 15:00:00 to 1/1/2002 15:01:00 is 24 hrs 1 min. Is there a function that I have not seen in "HELP"?

Re: Calculating date and time events

Posted by Barrie Davidson on December 31, 2001 7:29 AM

Mike, all you need to do is subtract the two and format the result to display hours and minutes. If you place the first date in cell A1, the second date in cell B1, the formula "=B1-A1" in cell C1, and custom format cell C1 to display hours and minutes, the result will be 24:01. To custom format, select Format|Cells from the main menu. Then, on the "Number" tab, select "Custom". In the "Type" box, type in

[h]:mm

This will display hours and minutes.

Hope this helps,
BarrieBarrie Davidson


This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.