Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
add/subtracting date:time in Excel 2000
Office 2000/Excel. Need to add and subtract date/time values Need to
return answers like Date 1 is 2 days 6 hours and 4 minutes ahead of date 2..... or date 1 is 3 days, 12 hours, 4 minutes BEHIND date 2. Can this be done....? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
add/subtracting date:time in Excel 2000
Do you mean in VBA (this is the programming group) or using worksheet
formulas. In VBA, (demo'd from the immediate window:) ? d1, d2 1/15/05 1:15:00 PM 1/17/05 5:30:00 PM ? datediff("n",d1,d2) 3135 ? datediff("n",d1,d2)/(24#*60#) 2.17708333333333 So Int( 2.17708333333333 ) gives you 2 days. subtract that from 2.17708333333333 and you get .17708333333333 multiply that times 24 and you get the remainder in hours. 4.24999999999992 follow a similar procedure to reduce 4.24999999999992 to get 4 hours and ..24999999999992 x 60 = 14.9999999999952 or round it for 15 minutes. 2 days, 5 hours and 15 minutes. -- Regards, Tom Ogilvy "Gordon" wrote in message ... Office 2000/Excel. Need to add and subtract date/time values Need to return answers like Date 1 is 2 days 6 hours and 4 minutes ahead of date 2..... or date 1 is 3 days, 12 hours, 4 minutes BEHIND date 2. Can this be done....? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
subtracting date/time | Excel Worksheet Functions | |||
Subtracting Date/Time | Excel Discussion (Misc queries) | |||
Subtracting time in date format | Excel Worksheet Functions | |||
Subtracting time in date format | Excel Worksheet Functions | |||
Subtracting time in date format | Excel Worksheet Functions |