View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Max[_9_] Max[_9_] is offline
external usenet poster
 
Posts: 20
Default Comparison of Time

On Monday, 14 August 2017 04:40:20 UTC+5:30, Auric__ wrote:
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.


Thanks Auric__, For your suggested solution.The Formula works fine for the Total Minutes. I also have the trouble in making formula to check weather the In-Time is before 09:00 Hrs or later than the Specific Time i.e 09:00 Hrs and same for the Out_Time as well. Hope I am able to explain my question you.