Question : Calculate the Net Hours

I need a VBA code / Formula / Function which will calculate the Net Hours worked. Presently I am using COL F to save Start Date (dd-mmm-yyyy hh:mm:ss am/pm) and COL G to save End Date (dd-mmm-yyyy hh:mm:ss am/pm) . I want COL H to display the Net Hours (hh:mm:ss). This Net Hours is only the time invested for the job so this will not calculate the hours for Sunday and Saturday and other holidays which I am keeping on COL I.

I need Experts' help on this. Thank you.

Answer : Calculate the Net Hours

Hi all:

I don't see why NETWORKDAYS will not work unless going past midnight throws off the holiday & weekend exclusions.  If that is the case we can just shift 3 time zones west by subtracting 3 hours [.125] from all times.  Now start & end times are on the same day.

Taking Barry's formula and shifting 3 time zones you get:

=(NETWORKDAYS(F2-.125,G2-.125,I2:I100)-1)*("23:30"-"14:30")+MOD(G2-.125,1)-MOD(F2-.125,1)

Simple example is attached

Bob
 
sample file showing timezone shift for calcualtion purpose
 
Random Solutions  
 
programming4us programming4us