Calculate how many hours in a time range falls within a predefined Time Range, spanning midnight

ito69

New Member
Joined
Aug 15, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
Let the predefined time range be

Battery_Time :
From -> 05:00 PM (lower)
To -> 06:00 AM (upper)
Total_Hrs = 13 hrs.

Using ONLY excel formula, I want to be able to know if the following ranges/shifts fall fully or partially within the Battery_Time range defined above, and if so, how many hours:



TimeStartEndTotal_HrsBattery_Hrs
T15:00 PM11:00 PM66
T26:00 PM5:00 AM1111
T311:59 PM2:00 AM2413
T412:00 AM11:59 PM2413
T510:00 AM2:00 PM40
T66:00 PM7:00 AM1312
T71:00 AM7:00 AM65
T82:00 PM8:00 PM63
This is for a Photovoltaic project; I want to be able to verify the percentage of my electrical loads that I need battery storage.



Thank you for your time
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
This is my formula , T3 & T4 do not work:

Excel Formula:
=MAX(0,[@[Total_Hrs]]-(IF([@Start]<lower,MOD(lower-[@Start],1)*24,0) + IF(MOD([@End],1)>0.5,IF([@End]<lower,MOD([@End]-[@Start],1)*24,0),IF([@End]>upper,MOD([@End]-upper,1)*24,0))))
 
Upvote 0
Let the predefined time range be

Battery_Time :
From -> 05:00 PM (lower)
To -> 06:00 AM (upper)
Total_Hrs = 13 hrs.

Using ONLY excel formula, I want to be able to know if the following ranges/shifts fall fully or partially within the Battery_Time range defined above, and if so, how many hours:



TimeStartEndTotal_HrsBattery_Hrs
T15:00 PM11:00 PM66
T26:00 PM5:00 AM1111
T311:59 PM2:00 AM2413
T412:00 AM11:59 PM2413
T510:00 AM2:00 PM40
T66:00 PM7:00 AM1312
T71:00 AM7:00 AM65
T82:00 PM8:00 PM63
This is for a Photovoltaic project; I want to be able to verify the percentage of my electrical loads that I need battery storage.



Thank you for your time
Please disregard T3
 
Upvote 0
Welcome to the MrExcel Message Board! :)

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at:

If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,215,794
Messages
6,126,944
Members
449,349
Latest member
Omer Lutfu Neziroglu

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