How do I store a battery's state of charge past midnight?

SolEnergy

New Member
Joined
Jun 5, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have an average battery state of charge (lets say a value between 0 and -10) calculated at five-minute intervals, which works great up until midnight. However, because this an average and not repeated for every day of the year, I don't know how to make it loop without being a circular reference. I can upload a sample file if the mini sheet below is too difficult to understand.

How do I make cell C5 (12:00AM) reference the value in C23 cell (11:55PM)? For example, if at 11:55PM the battery has a state of charge of 4, it should loop and use the value for 12:00AM, then 12:05AM uses the value from 12:00AM, etc. I would prefer the solution to be a formula so that this file can be passed to colleagues without needing to know VBA or Power Query.

Example.xlsx
ABCDEFGHIJKLMNOPQR
1Existing - no loopHow it should look - loopedHow it actually looks - loopedMax battery stateMin battery state
2100
3JanEnergy ConsumptionBattery StateJanEnergy ConsumptionLooping Battery StateJanEnergy ConsumptionLooping Battery State
4Midnight0MidnightMidnight
512:00:00 AM1012:00:00 AM5-512:00:00 AM50
612:05:00 AM1012:05:00 AM5012:05:00 AM50
712:10:00 AM1012:10:00 AM5012:10:00 AM50
812:15:00 AM1012:15:00 AM5012:15:00 AM50
912:20:00 AM1012:20:00 AM5012:20:00 AM50
1012:25:00 AM1012:25:00 AM5012:25:00 AM50
1112:30:00 AM1012:30:00 AM5012:30:00 AM50
12SunriseSunriseSunrise0
131:00:00 PM-5-51:00:00 PM-5-51:00:00 PM-50
141:05:00 PM-5-101:05:00 PM-5-101:05:00 PM-50
151:10:00 PM-5-101:10:00 PM-5-101:10:00 PM-50
161:15:00 PM-5-101:15:00 PM-5-101:15:00 PM-50
171:20:00 PM-5-101:20:00 PM-5-101:20:00 PM-50
181:25:00 PM-5-101:25:00 PM-5-101:25:00 PM-50
19SunsetSunsetSunset0
2011:40:00 PM1-911:40:00 PM2-911:40:00 PM20
2111:45:00 PM1-811:45:00 PM2-811:45:00 PM20
2211:50:00 PM1-711:50:00 PM2-711:50:00 PM20
2311:55:00 PM1-611:55:00 PM2-611:55:00 PM20
24MidnightMidnightMidnight
Sheet1
Cell Formulas
RangeFormula
C4C4=R2
C5:C11,M6:M23,C21:C23,C13:C18C5=MIN(MAX(C4+B5,$Q$2*-1),$R$2)
H5H5=MIN(MAX(C23+B5,$Q$2*-1),$R$2)
H6:H11,H21:H23,H14:H18H6=MIN(MAX(C5+B6,$Q$2*-1),$R$2)
H13,H20H13=MIN(MAX(C11+B13,$Q$2*-1),$R$2)
C20C20=MIN(MAX(C18+B20,$Q$2*-1),$R$2)
M5M5=MIN(MAX(M23+L5,$Q$2*-1),$R$2)


Cheers
 

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
Hi *SolEnergy and Welcome to the Board! Maybe C4 should be =IF(R23<>0,R23,R3) HTH. Dave
Hi Dave

Thanks for lending a hand. I think this is what you mean? A good idea, but we still have the issue where every subsequent row relies on what the row above is, which makes this circular. I'm thinking maybe I need to use Power Query and process every line for the whole year and then average it in a Pivot Table?
Screenshot 2024-06-07 112045.png
 
Upvote 0
Whoops... I was actually thinking that C4 should be =If(C23 <> 0, C23, R2) I messed that up and I don't think that I fully understand what you're objective is? What actually exists... Columns A:H? I'm not real sure of the role of R2 and/or Q2 ....starting state values for testing? What about the rest of the day's time increments? Maybe add 11:59:59 to A24 and create B24 & C24 values, then you're H5 value would approximate your C24 (1 sec difference). Seems like a recursion error may be created with successful formula looping. Perhaps with a bit more explanation, others may have a nifty solution. Dave
 
Upvote 0

Forum statistics

Threads
1,223,887
Messages
6,175,199
Members
452,617
Latest member
Narendra Babu D

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