Count of hours within time range

Chartley86

New Member
Joined
Jan 26, 2018
Messages
7
Column D contains a list of time ranges e.g. D1 is 16:00-22:00, i need a formula to return the amount of full, consecutive hours within another time range, this will always be 20:00-06:00. So for the example D1 i would need a return of 2 hours.
Thanks
 
Sorry my typing error, i meant when the hours are 16:00 - 00:00 the second formula is giving me -0.8333 instead of 4
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
This formula is becoming a bit unwieldy to try to handle all the different possible scenarios.
Would you be opposed to using VBA to create our own function in order to do this?
 
Upvote 0
Visual Basic for Applications. Sometimes people refer to it as "Macros".

Basically, we can use Visual Basic code to build our own function. The only caveat is that you must allow for VBA to run in your workbook.
If you are subject to some sort of workplace security, you may need to check with them to make sure that they allow for you to use it.
 
Upvote 0

Forum statistics

Threads
1,223,948
Messages
6,175,575
Members
452,652
Latest member
eduedu

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