formula to calculate work hours between two dates of a work week - Sunday to Thursday.

azkhan

New Member
Joined
Jun 9, 2010
Messages
29
Hi there,

Please help me with a formula for the situation below.

Work week is from Sunday to Thursday (8.30 am to 5.30 pm with one hour lunch break)

Example:
StartDate: 01/06/2010 10:00 AM in A1
EndDate: 09/06/2010 04:00 PM in B1

I need to calculate work hours (in decimal format e.g 30.75 hours) between the above start and end date_time considering a work day is of 8 hours and non-working days are Fridays & Saturdays along with any HolidayList.

I'm Feeling Lucky :)
 
Is that using 9 hours?

=(SUM(IF(ISERROR(MATCH(WEEKDAY(ROW(INDIRECT(INT(A1)+1&":"&INT(A2)-1))),{6,7},0)),1,0))*9)+((("17:30"-MOD(A1,1))+(MOD(A2,1)-"08:30"))*24)

Don't forget Ctrl+Shift+Enter.
 
Upvote 0

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Sorry for being a pain. I am just a basic - intermeditae level user of excel as well as new to this website; therefore I do not know how to attach an excel file to this thread. Could you please provide full formula for the below example in a excel file if possible or just provide the full formula in the thread.?

A1 - 03/06/2010 10:00:00
B1 - 09/06/2010 17:00:00

A4 - 08:30
A5 - 17:30

The result i am expecting is 43 hours (43 hours from 5 working days 3,6,7,8 & 9)
 
Upvote 0
That would be:

=(SUM(IF(ISERROR(MATCH(WEEKDAY(ROW(INDIRECT(INT(A1)+1&":"&INT(B1)-1))),{6,7},0)),1,0))*9)+(((A5-MOD(A1,1))+(MOD(B1,1)-A4))*24)

confirmed with Ctrl+Shift+Enter.
 
Upvote 0
BTW - I tried the formula you (only the string above and not with the lenghthy one)and it resulted 16 hours.
 
Upvote 0
Well the lunch hour is not fixed for everyone and now i am thinking of taking full nine hours after I realised that it is for TAT calculation and not for payroll. It is fine to ignore the lunch break and consider day to be 9 hours.
 
Upvote 0
Made sure with Ctrl+Shift+Enter. It is counting Fridays and excluding Sat & Sun. We need to exclude Fri & Sat and count Sunday.
 
Upvote 0
Will start and end times always be within working hours? What time is lunch?

Sorry missed the first Q.

Mostly the Start and End fall within the work hours.
<!-- / message -->
 
Upvote 0
This formula should give you the correct answer assuming start and end times are within the working hours

=(NETWORKDAYS(A1+1,B1+1,INDEX(holidays+1,0))-1)*9+(MOD(B1,1)-MOD(A1,1))*24

format as number

[Note: although it uses NETWORKDAYS the +1 adjustment means that Sunday and Monday are counted as holidays.]

The holidays part is optional (assuming you have a named range called holidays), if you don't want to consider holidays change to

=(NETWORKDAYS(A1+1,B1+1)-1)*9+(MOD(B1,1)-MOD(A1,1))*24
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top