View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Auric__ Auric__ is offline
external usenet poster
 
Posts: 538
Default Comparison of Time

Max wrote:

I have to report employees total numbers of In time punch that are after
09:00 hours and number of Out time before say 18:00 hours in a month say
total 50 employees and for 30 days of a month... Is there a easy way
with the help of VBA to achieve this..

my data is like this
01-Aug-17
Employee In_Time Out_Time Minutes
1 9:35 18:00 505
2 9:20 17:58
3 9:15 19:15


Does it need to be VBA? I use a formula like this for a similar purpose:

=([Out_Time]-[In_Time])*1440

If it absolutely must be VBA, use this:

result = (Range("[Out_Time]").Value - Range("[In_Time]").Value) * 1440

In either case, replace [Out_Time] and [In_Time] with appropriate cell
addresses.

Note: This only works if your times don't cross midnight. If they do, this
thread shows how to deal with that (written specifically for my data), but
it's kind of a bitch. Watch the wordwrap:

https://groups.google.com/forum/#!
topic/microsoft.public.excel.worksheet.functions/aDkj8ab8iwY

--
Conversation is not only the vehicle of thought,
it is a tremendous and efficient instrument in thinking.