calulate time from two different dates and times without non working hours

krifenbery

New Member
Joined
Dec 18, 2013
Messages
2
I'm trying to calculate the total elapsed time from two different dates and times, however I need to subtract out 2am-5am since no work is going on. Please see example below:
A2 Date Start 12/01/13
B2 Time Start 1:00
C2 Date End 12/04/13
D2 Time End 18:00
E2 Time Elapsed (hrs) ??? I know that =((C2+D2)-(A2+B2))*24 will work except for subtracting out the hrs of 2am to 5am. Please help.
Kyle
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hello Kyle, welcome to MrExcel

I assume all days are workdays? If so then try this formula for elapsed working hours

=(C2+D2-A2-B2)*24-(C2-A2)*3-MEDIAN(D2*24,2,5)+MEDIAN(B2*24,2,5)

format result cell as general or number and you should get 77 for your example
 
Upvote 0

Forum statistics

Threads
1,216,031
Messages
6,128,424
Members
449,450
Latest member
gunars

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