Energy forcasting, factoring in Imported from Grid, Exported and Self consumed

GLOpro

Board Regular
Joined
Jul 30, 2005
Messages
117
Hi!

I am looking for help with a spreadsheet that contains the following daily CSV data


The sample below represents the top values in for the first 6 columns.

Utilising the daily data set (3yrs worth) how can i create a sheet that will find me the matching data set for a nominated period.

For example:
query 1: Find the best highest sum total for a (1,3,6,9,12month) rolling period for any of the first 6 columns.
query 2: Have a separate sheet that will allow me to add: 1. Solar Feed In Tariff 2. Daily Supply Charge and 3. Peak Usage Charge per kWh.

Thanks for everyones help and suggestions.

SolarEnergy Sample 2022.xlsm
ABCDEFGHIJK
1Time StampEnergy Generated (Wh)Energy Consumed (Wh)Energy Expected (Wh)PV Energy Consumed (Wh)PV Energy Exported (Wh)Grid Energy Imported (Wh)PV Energy Consumed/ Energy ConsumedGenerated/ImportedExported - Imported mWhBar Graph
231/07/202223099.119125070.387523837.720167485.549815613.589617544.618330%132%-1.9310287-1.9310287
330/07/202242977.788435656.897135832.690259903.855433073.915625714.058428%167%7.35985727.3598572
429/07/202242806.448617751.72936713.207726995.388435811.063210809.88239%396%25.001181225.0011812
528/07/202241509.710521596.688535067.247339438.417132071.284412166.15444%341%19.905130419.9051304
627/07/202242822.206447095.971736478.839918142.66834679.542538966.086217%110%-4.2865437-4.2865437
726/07/202230664.201630306.967229454.209517051.865723612.36723241.046723%132%0.37132030.3713203
825/07/202238825.897730489.33435191.82019187.121629638.771121306.460330%182%8.33231088.3323108
924/07/202234369.887222442.470233912.669738844.001925525.879913567.653939%253%11.95822611.958226
1023/07/202216123.06927476.695319938.375366980.47789142.613220544.068225%78%-11.401455-11.401455
1122/07/202217171.336834145.288820160.881544452.354212718.989829674.123613%58%-16.9551338-16.9551338
1221/07/202212668.693241594.175815077.084136152.83386515.854835435.136115%36%-28.9192813-28.9192813
1320/07/202214761.628341537.937914593.835326808.86157952.741734748.372416%42%-26.7956307-26.7956307
1419/07/202226193.067631477.308427049.302737562.080918630.964223897.693924%110%-5.2667297-5.2667297
1518/07/202239358.029527229.351534975.2729811726.383427631.648115507.140443%254%12.124507712.1245077
1617/07/202240393.014322960.659434803.260789811.642830581.370413144.472643%307%17.436897817.4368978
1716/07/202223148.235345192.538927171.727877622.872815525.388237566.258817%62%-22.0408706-22.0408706
1815/07/202240071.413828312.159434056.7762315876.65324194.736412438.88456%322%11.755852411.7558524
1914/07/202228319.30545127.996828219.1264819640.51698678.785125509.724144%111%-16.830939-16.830939
2013/07/202232346.754824828.002230833.337496693.191625653.570618130.0727%178%7.52350067.5235006
2112/07/202229485.209535391.188831698.9410513015.934316469.299422324.525637%132%-5.8552262-5.8552262
2211/07/202226790.841924284.922326037.065286109.041420681.82318213.860125%147%2.46796292.4679629
2310/07/202222888.363746373.629722163.2149910844.74312043.569635505.75223%64%-23.4621824-23.4621824
249/07/202235899.742321569.064833672.447287528.306628371.428414062.615235%255%14.308813214.3088132
258/07/202239847.792132806.524435191.82016456.796133391.007426346.748820%151%7.04425867.0442586
267/07/202217640.136622425.437724408.925058301.95439338.188414136.359437%125%-4.798171-4.798171
276/07/20227091.90732807.508112316.49055486.88721605.023227313.519217%26%-25.708496-25.708496
285/07/20229620.017139584.706714449.173165923.04723697.109733655.491115%29%-29.9583814-29.9583814
294/07/20224742.741323957.97568842.3835723270.581472.048420686.978514%23%-19.2149301-19.2149301
303/07/20224910.824335773.12748910.366584632.524278.276731140.696213%16%-30.8624195-30.8624195
312/07/20222861.686534911.12724557.2193752719.0565142.633232198.77898%9%-32.0561457-32.0561457
321/07/20225468.139428338.42738776.8566574571.0016897.111523766.419316%23%-22.8693078-22.8693078
3330/06/202219924.718835926.346624092.8471410386.43049538.304425529.649229%78%-15.9913448-15.9913448
3429/06/202228350.966737078.515929656.0133612571.534215779.413524527.683234%116%-8.7482697-8.7482697
3528/06/202223438.339446032.50125054.3507210428.65713009.675435584.510123%66%-22.5748347-22.5748347
3627/06/202228285.286735507.122427528.47448617.289619668.006126882.21124%105%-7.2142049-7.2142049
3726/06/202222977.871221326.111826814.8016710030.156312947.732411290.396647%204%1.65733581.6573358
3825/06/202234183.871230346.378432130.022928601.927325581.931121762.483628%157%3.81944753.8194475
3924/06/202219230.763926700.665619235.011099665.18369565.583717029.309936%113%-7.4637262-7.4637262
4023/06/202235402.524732691.257332672.124466802.212628600.319825910.568421%137%2.68975142.6897514
4122/06/202236232.622934044.025631170.963418433.613117799.025715596.980754%232%2.2020452.202045
4221/06/202225194.957337692.265124131.2122710204.388514990.578327483.431327%92%-12.492853-12.492853
4320/06/202221994.863733886.734920756.760728655.618113339.252525238.645826%87%-11.8993933-11.8993933
4419/06/202230448.982118097.583225041.385758978.227621470.71949133.802150%333%12.336917312.3369173
4518/06/202233895.750318926.353930630.250167007.379426888.378511897.17437%285%14.991204514.9912045
4617/06/202232313.139632831.801129135.487677504.555224808.575225335.099823%128%-0.5265246-0.5265246
4716/06/202234101.230723218.811828915.2734411184.600922916.639512035.830248%283%10.880809310.8808093
4815/06/202238137.93743299.531232305.8709627209.683710928.272716087.293463%237%-5.1590207-5.1590207
4914/06/202238292.110333238.309432217.8301418754.008319538.095114483.229556%264%5.05486565.0548656
5013/06/202237252.771636349.772832251.1642819806.90817445.838916541.566754%225%0.90427220.9042722
5112/06/202239084.336327183.245433758.302399126.370829957.956618032.788534%217%11.925168111.9251681
5211/06/202239014.882436505.195633596.0468810312.468128702.420926225.48128%149%2.47693992.4769399
5310/06/202239755.043446542.284533729.1489721165.912418589.131325378.096945%157%-6.7889656-6.7889656
549/06/202239622.620948992.959634234.91218131.923321490.697130854.088337%128%-9.3633912-9.3633912
558/06/202240675.885448636.465934098.2756220803.269119872.620727840.470143%146%-7.9678494-7.9678494
567/06/202237102.795335130.993532783.1445911114.773925988.016724007.339432%155%1.98067731.9806773
576/06/202239913.20939217.293134361.754419952.570329960.637929279.946425%136%0.68069150.6806915
585/06/202225094.843130158.336925412.941268125.989316968.86122009.62227%114%-5.040761-5.040761
594/06/202239811.871318992.969333064.008379840.526929971.36989161.595352%435%20.809774520.8097745
603/06/202217560.320847632.227617057.3151515223.13342337.166732421.077432%54%-30.0839107-30.0839107
612/06/202230961.151552454.340827070.2266221454.97639505.960830754.0541%101%-21.2480892-21.2480892
621/06/202241836.147259157.235734697.0962530857.525710978.825828531.258552%147%-17.5524327-17.5524327
6331/05/202236562.024629383.439427983.844399351.651527210.380620040.997732%182%7.16938297.1693829
6430/05/202211825.22435272.330111644.038776636.34095188.888828649.826319%41%-23.4609375-23.4609375
6529/05/202241217.877329057.340433779.667748066.014533151.868320969.25828%197%12.182610312.1826103
6628/05/202228255.673917385.394527235.293037969.426220286.2659403.089846%300%10.883175210.8831752
6727/05/202237355.379717935.527231902.09019023.261428332.04868851.958350%422%19.480090319.4800903
6826/05/202236840.390619191.538732009.723447102.165229738.286612140.332237%303%17.597954417.5979544
6925/05/202232902.285421580.081530705.544888755.177424147.110312851.888241%256%11.295222111.2952221
7024/05/202221672.683820663.716321379.423179304.739812367.948411354.553345%191%1.01339511.0133951
7123/05/202228583.453524800.038423009.879039317.943619265.510715487.985838%185%3.77752493.7775249
7222/05/202221144.45718208.04121174.731567325.387213819.082410860.926540%195%2.95815592.9581559
7321/05/202214562.757619021.740913224.983127053.13987509.624311965.097837%122%-4.4554735-4.4554735
7420/05/202213554.785623269.971612050.95037330.7456223.999415956.435732%85%-9.7324363-9.7324363
7519/05/202238144.355116517.362532769.378117355.353130788.99919173.043145%416%21.61595621.615956
7618/05/202241439.047524098.357834106.5773310388.865931050.187313719.267743%302%17.330919617.3309196
7717/05/202242675.601221586.900134245.2527413062.088429613.4958494.703661%502%21.118791421.1187914
7816/05/202241848.345921245.757333588.837639328.006632520.386211926.861544%351%20.593524720.5935247
7915/05/202213082.26517729.152312934.463066224.05036858.218611474.096435%114%-4.6158778-4.6158778
8014/05/202223975.21717341.669322731.919335697.563118277.649711651.155933%206%6.62649386.6264938
8113/05/202214695.813920847.05314757.924856995.28277700.530713869.306534%106%-6.1687758-6.1687758
8212/05/20226954.03618212.10928290.1598475457.69341496.348212761.024130%54%-11.2646759-11.2646759
8311/05/20227264.81217196.65929484.487395693.41541571.361511521.514633%63%-9.9501531-9.9501531
8410/05/202233823.152619105.169928371.136999427.19424395.98119667.963749%350%14.728017414.7280174
859/05/202215655.206418064.556614888.77283.08988372.096710784.399440%145%-2.4123027-2.4123027
868/05/202244337.642915949.786932808.839487728.181236609.45668215.208948%540%28.394247728.3942477
877/05/202245180.403722089.067336204.930949897.763635282.64512205.594445%370%23.077050623.0770506
886/05/202246507.456715862.795836023.531178120.770638386.7017727.222351%602%30.659478730.6594787
895/05/202231400.895418662.646428317.869398424.814322976.061310176.593845%309%12.799467512.7994675
904/05/202239619.981221030.765732671.100299102.682130517.339511993.370743%330%18.523968818.5239688
913/05/202245429.974218662.66234997.289649182.221636247.74129458.263349%480%26.789477926.7894779
922/05/202240315.734124451.30232981.3110110567.450629748.275913858.611443%291%15.889664515.8896645
931/05/202241706.499721661.95634455.2539710451.326231255.152811254.741348%371%20.000411520.0004115
177117-LO_-_Bardia-DailyDat (2)
Cell Formulas
RangeFormula
H2:H93H2=E2/C2
I2:I93I2=B2/G2
J2:J93J2=(F2-G2)/1000
K2:K93K2=J2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
K2:K700Other TypeDataBarNO
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
As for your Query #2, besides add in another sheet with those columns, I don't know what you want or how you get it based on what you've given us.

Here's what I did for Query #1:
Create a new sheet with the rolling month for each column. I assumed 30 days for each month and 365 for a year as shown (Because I don't have 6 months of data, the last 3 month ranges are all zero, you'll have to check those):
Time StampEnergy Generated (Wh)Energy Consumed (Wh)Energy Expected (Wh)PV Energy Consumed (Wh)PV Energy Exported (Wh)Grid Energy Imported (Wh)
1 Month (30 days)1018658.851067797.64888351.6981400951.81649654.49748670.78
3 Month (90 days)2638696.842646285.472404431.465889875.351748821.51759461.3
6 Month (180 days)000000
9 Month (270 days)000000
12 Month (365 days)000000


Then put in this code. it will loop through all the rows of data, one day at a time and check the monthly intervals and find the max. It then moves on to the next column and does the same. Then it moves on to the next set of monthly intervals and proceeds.
VBA Code:
Sub findMaxes()
'https://www.mrexcel.com/board/threads/energy-forcasting-factoring-in-imported-from-grid-exported-and-self-consumed.1212802/
LastRow = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
Dim MoInt As Variant
Dim CurrMax As Variant
Dim IsMax As Variant
Dim CurrRng As Range
MoInt = Array(30, 90, 180, 270, 365)
'for each Monthly Interval
For k = 0 To UBound(MoInt)
        'for each Energy Usage
        For j = 2 To 7
            'go through each row, one day at a time
            For i = 2 To LastRow - MoInt(k)
                'get the max sum for that monthly interval
                Set CurrRng = Range(Cells(i, j), Cells(i + MoInt(k) - 1, j))
                CurrMax = WorksheetFunction.Sum(CurrRng)
                'if it's bigger than the last one, save it
                If CurrMax > IsMax Then IsMax = CurrMax: Cells(k + 2, j) = IsMax
                CurrMax = 0
            Next i
        'print the max in the column at the top
        MyNewSheet.Cells(k + 2, j) = IsMax  'change MyNewSheet to your new sheetname
        IsMax = 0
        'go to the next energy usage
        Next j
'go to the next interval
Next k

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

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