Calculating hours outside of certain times

davidcox9

New Member
Joined
Sep 21, 2023
Messages
12
Platform
  1. Windows
I'm trying to calculate the number of hours outside of 7am - 3pm. I need a formula to update the # of hours to all be 8 hours and I haven't figured it out yet.

Time inTime out# of hoursWhat I need it to be
11:00:00 PM​
7:15:00 AM​
8.25​
8.00​
11:00:00 PM​
11:00:00 AM​
12.00​
8.00​
11:00:00 PM​
7:00:00 AM​
8.00​
8.00​
I can't get the right formula to get the above number
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
How about:
Excel Formula:
=((24*60/1440)-IF(A2<15*60/1440,15*60/1440,A2))+IF(B2>7*60/1440,7*60/1440,B2)
 
Upvote 0
I made a slight change to get the correct format I need. Thanks for the help!
=(((24*60/1440)-IF(A2<15*60/1440,15*60/1440,A2))+IF(B2>7*60/1440,7*60/1440,B2))*24
 
Upvote 0
it works if the hours are 11pm and 7 am, can you help me with the below example. The 16 should be 8 as well as they only have 8 hours worked.

3:00:00 PM​
11:00:00 PM​
16​
11:00:00 PM​
7:00:00 AM​
8​
 
Upvote 0
Then this should do it:
Excel Formula:
=(IF(A2>B2,((24*60/1440)-IF(A2<15*60/1440,15*60/1440,A2))+IF(B2>7*60/1440,7*60/1440,B2),B2-IF(A2<15*60/1440,15*60/1440,A2)))*24
 
Upvote 0
Sorry I am just now getting to work on this again. So far this looks like it is working I appreciate it so much!
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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