Hey,
I can’t figure out why this formula is not working. I am trying to alter it a little, but I still think it should work. Here is what I am trying to do. I am looking to calculate the time difference between two work projects, but exclude time when the office is closed. So someone starts a project at 2pm and finish 10am the next day it will show a result of 4 hours because the office closes at 5.
Here is the formula. It is the time formula from cpearson.com. http://www.cpearson.com/excel/DateTimeWS.htm
=IF(AND(INT(D1)=INT(D2),NOT(ISNA(MATCH(INT(D1),HolidayList,0)))),0,ABS(IF(INT(D1)=INT(D2),ROUND(24*(D2-D1),2),(24*(DayEnd-DayStart)*(MAX(NETWORKDAYS(D1+1,D2-1,HolidayList),0)+INT(24*(((D2-INT(D2))-(D1-INT(D1)))+(DayEnd-DayStart))/(24*(DayEnd-DayStart))))+MOD(ROUND(((24*(D2-INT(D2)))-24*DayStart)+(24*DayEnd-(24*(D1-INT(D1)))),2),ROUND((24*(DayEnd-DayStart)),2))))))
D1 is the start time of the first project. (ex: 7/4/2008 7:40:35)*
D2 is the start of the second project & I am using that as the end time of the first project. (7/4/2008 13:01:16)*
DayEnd is the time the office closes.
DayStart is the time the office opens.
*Dates in dd/mm/yyyy format.
All my results come up as zeros, regardless of how I format the cells. I would think that this formula would be able to count down to the minute.
Also, has anyone ever included break times using this formula? I would like to add that in, but I haven’t really focused on it yet.
Any suggestions, ideas will be much appreciated.
Bookmarks