Hi,
I have read post upon post related to this topic but unfortunately none of them produce the effect I am hoping for. Hopefully someone with more excel knowledge will be able to provide some helpful hints!
What I am looking for:
I need to calculate working hours (Monday-Friday) between 2 dates. To add an extra layer to this the working hours differ depending on the day of the week)
Monday -Thursday: 07:45 - 16:45 (9 hours)
Friday: 07:45 - 11:45 (4 hours)
I have found a formula (salvaged from Google) that does this perfectly (where A2 is the start date and B2 is the end date):
Unfortunately, here is where we come to the 'twist' part of the question! This calculation is required for a SharePoint 2010 calculated column and SharePoint calculated columns do not support array formulas such as SUMPRODUCT()!
I have tried creating 5 formulas to calculate the working hours for Monday, Tuesday, Wednesday, Thursday and Friday using something like:
Working hours for Wednesday:
But this does not work - The formula above shows double the amount of hours that there should be in the day (if dates 10/12/2012 07:45:00 - 12/12/2012 16:45:00 are used). IE. where there should be 9 hours it shows 18, where there should be 0 it shows 9!
I guess I am looking to see if it is indeed possible to create a formula that calculates working hours between 2 dates (either 5 separate formulas for each working day or one single one for the whole week) using no array formulas.
NOTE: I am using the WEEKDAY() formula simply because SharePoint doesn't support NETWORKDAYS()
One last point (that might help someone else reading this). If you work the same hours every day of the week this formula works:
Unfortunately our company chose to be difficult so this doesn't work for us * cries * lol
Any help would be much appreciated! If you don't understand anything I'd be happy to clarify.
Thanks a lot
Dave
I have read post upon post related to this topic but unfortunately none of them produce the effect I am hoping for. Hopefully someone with more excel knowledge will be able to provide some helpful hints!
What I am looking for:
I need to calculate working hours (Monday-Friday) between 2 dates. To add an extra layer to this the working hours differ depending on the day of the week)
Monday -Thursday: 07:45 - 16:45 (9 hours)
Friday: 07:45 - 11:45 (4 hours)
I have found a formula (salvaged from Google) that does this perfectly (where A2 is the start date and B2 is the end date):
Code:
=((SUMPRODUCT(INT((WEEKDAY(A2-{2,3,4,5,6})+INT(B2)-INT(A2))/7),{9,9,9,9,4})+(MOD(B2,1)-MOD(A2,1))*24+IF(WEEKDAY(A2)=7,8,7)-IF(WEEKDAY(B2)=7,12,16))/24)*24
Unfortunately, here is where we come to the 'twist' part of the question! This calculation is required for a SharePoint 2010 calculated column and SharePoint calculated columns do not support array formulas such as SUMPRODUCT()!
I have tried creating 5 formulas to calculate the working hours for Monday, Tuesday, Wednesday, Thursday and Friday using something like:
Working hours for Wednesday:
Code:
=(INT((B2-WEEKDAY(B2+1-4)-A2+8)/7)*("16:45"-"07:45")+MOD(B2,1)-MOD(A2,1))*24
But this does not work - The formula above shows double the amount of hours that there should be in the day (if dates 10/12/2012 07:45:00 - 12/12/2012 16:45:00 are used). IE. where there should be 9 hours it shows 18, where there should be 0 it shows 9!
I guess I am looking to see if it is indeed possible to create a formula that calculates working hours between 2 dates (either 5 separate formulas for each working day or one single one for the whole week) using no array formulas.
NOTE: I am using the WEEKDAY() formula simply because SharePoint doesn't support NETWORKDAYS()
One last point (that might help someone else reading this). If you work the same hours every day of the week this formula works:
Code:
=(((FLOOR(B2-A2,0.5))-INT((FLOOR(B2-A2,0.5)/7))*2-IF((WEEKDAY(B2)-WEEKDAY(A2))<0,2,0))*("16:45"-"07:45")+MOD(B2,1)-MOD(A2,1))*24
Unfortunately our company chose to be difficult so this doesn't work for us * cries * lol
Any help would be much appreciated! If you don't understand anything I'd be happy to clarify.
Thanks a lot
Dave