Posted to microsoft.public.excel.programming
|
|
Calculating Time and Date Differences
Excellent, after a little tweeking it now works perfectly!
Thank you very much.
"HiArt" wrote:
Excel holds dates and times in numbers, so what you are after seems like
a simple subtraction.
days_open = create_date - resolve_date
But...
what about weekends and holidays? Answer use
NetWorkDay(create_date, resolve_date, holiday_range)
Note that the same day returns a value of 1, so if you need to add 10
hours for each day the number of hours to add would be:
=((NetWorkDay(create_date, resolve_date, holiday_range)-1)*10
The time can be a simple subtraction
hours_open = resolve_time - create_time
This returns a fraction of a day (0.041667 = 1 hour) so multiply by 24
to return hours.
hence the formulae you are after, in the cell, is:
=((NetWorkDay(create_date, resolve_date, holiday_range)-1)*10) +
((resolve_time - create_time)*24)
HTH
Art
P.S.
I would but validation (menu DataValidation) rules on the cell ranges
to make sure you don't enter dates and times in invalid formats.
--
HiArt
------------------------------------------------------------------------
HiArt's Profile: http://www.excelforum.com/member.php...o&userid=19953
View this thread: http://www.excelforum.com/showthread...hreadid=345803
|