View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Time Calculations using VBA.

I don't think I ever got to writing the solution. Just managed to describe
the solution.
As I recall, it was for ambulance resource management. Norman Harker
provided the solution offline. Perhaps, if he's listening, he can provide
you the quick answer?

I will be posting a solution within the next few days and if I ever get
around to putting a website up.... well...

The logic goes a little like this:
Think about the 4 events. A, B, C, D.
A = Start Time
B = End Time
C = Interval Start
D = Interval End

Figure out the permutations (I found John Walkenbach's VBA routine handy for
this: http://www.j-walk.com/ss/excel/tips/tip46.htm)

You'll get 24 combinations, but assuming C always occurs before D then 12 of
those can be eliminated.

It's strange to think that B could occur before A, but times don't have a
date. So while it's possible a troubleticket might have been (A, B) from
1-Jan-2004 14:00 to 3-Jan-2003 09:00, the times we compare are without the
date.


Stay tuned.

Rob



"Clay Watson" wrote in message
...
Hello, Rob van Gelder and any other VBA afficionados out there! That
was a clever solution to the date/time workday calculation question you
provided. Could I ask about a somewhat different scenario?

Instead of Excel, my situation is in Access. I have two date/time
fields, one for Start and one for Finish. I am trying to calculate net
workday work hours. If a trouble ticket is not resolved (Finish) on the
same day, I need to calculate how many 8a-5p Mon-Fri workday hours
elapsed.

Looks like Excel has a NetWorkday function. Would it be easiest for me
to import my Access data into Excel, and attempt to use Excel? THANK
YOU.
.Clay



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!