Sumifs Formula not working

MAP77

Board Regular
Joined
Sep 19, 2018
Messages
60
Office Version
  1. 365
Platform
  1. Windows
Hi all,
I have been using a SumIFs formula in other files, and it has worked fine. For some reason, when I use it in a new worksheet with different data but calculating the same thing, it doesn't work. I've triple-checked all the references and cannot figure out why it won't just work. My data goes down to row 3313.

The formula is to calculate the amount of kWh used in a day and night for each date. (Columns M and N).
Eg. M2 should equal D13: D49

Thanks guys.

Data File.xlsx
ABCDEFGHIJKLMNO
1DatetimeMonthSum of Energy Consumed (kWh)Sum of Air Conditioner (kWh)Sum of Electric Hot Water (kWh)Sum of EV Charger (kWh)Period5:30:00 AM6:00:00 PMMonthDateDayNight
223/04/202312:00:00 AMApril0.040.002503900.0106435NightApril23/04/202300.035552
323/04/202312:30:00 AMApril0.040.002514700.0106078NightMay24/04/202300
423/04/20231:00:00 AMApril0.020.002477500.0081433NightJune25/04/202300
523/04/20231:30:00 AMApril0.080.00250970.0520.0077169Night26/04/202300
623/04/20232:00:00 AMApril1.050.00298451.0320.0084991Night27/04/202300
723/04/20232:30:00 AMApril0.030.002492300.0077424Night28/04/202300
823/04/20233:00:00 AMApril0.030.002490300.0076756Night29/04/202300
923/04/20233:30:00 AMApril0.030.002484900.0076501Night30/04/202300
1023/04/20234:00:00 AMApril0.020.00248400.008485Night1/05/202300
1123/04/20234:30:00 AMApril0.030.002490300.0090066Night2/05/202300
1223/04/20235:00:00 AMApril0.030.002489300.0082875Night3/05/202300
1323/04/20235:30:00 AMApril0.030.002481600.0079983Day4/05/202300
1423/04/20236:00:00 AMApril0.030.002485500.0077408Day5/05/202300
1523/04/20236:30:00 AMApril0.020.002476700.0075436Day6/05/202300
1623/04/20237:00:00 AMApril0.030.002488300.007641Day7/05/202300
1723/04/20237:30:00 AMApril0.030.002520600.0076639Day8/05/202300
1823/04/20238:00:00 AMApril0.030.002521700.0076587Day9/05/202300
1923/04/20238:30:00 AMApril0.030.00250200.0074767Day10/05/202300
2023/04/20239:00:00 AMApril0.030.002503800.0074452Day11/05/202300
2123/04/20239:30:00 AMApril0.340.00266380.2270.0081617Day12/05/202300
2223/04/202310:00:00 AMApril0.900.00290970.8170.0084084Day13/05/202300
2323/04/202310:30:00 AMApril0.060.002521400.0162051Day14/05/202300
2423/04/202311:00:00 AMApril0.310.002666700.0166719Day15/05/202300
2523/04/202311:30:00 AMApril0.260.002672100.0158933Day16/05/202300
2623/04/202312:00:00 PMApril0.210.002671600.0142167Day17/05/202300
2723/04/202312:30:00 PMApril0.080.002548100.0077811Day18/05/202300
2823/04/20231:00:00 PMApril0.060.002522600.0075752Day19/05/202300
2923/04/20231:30:00 PMApril0.050.002517800.0117491Day20/05/202300
3023/04/20232:00:00 PMApril0.050.002522100.0081508Day21/05/202300
3123/04/20232:30:00 PMApril0.040.002511300.0074842Day22/05/202300
3223/04/20233:00:00 PMApril0.030.002515300.0074786Day23/05/20230
3323/04/20233:30:00 PMApril0.100.002560600.0078832Day24/05/20230
3423/04/20234:00:00 PMApril0.060.00253200.0152734Day25/05/20230
3523/04/20234:30:00 PMApril0.060.002522800.0178857Day26/05/20230
3623/04/20235:00:00 PMApril0.060.002516400.0178766Day27/05/20230
3723/04/20235:30:00 PMApril0.040.002498100.0108217Day28/05/20230
3823/04/20236:00:00 PMApril0.030.002488400.0072872Day29/05/20230
3923/04/20236:30:00 PMApril0.030.002501300.0073062Night30/05/20230
4023/04/20237:00:00 PMApril0.030.00251100.0073353Night31/05/20230
4123/04/20237:30:00 PMApril0.990.00294080.9640.0079747Night1/06/20230
4223/04/20238:00:00 PMApril0.030.00247670.0050.0072527Night2/06/20230
4323/04/20238:30:00 PMApril0.030.00248800.0072628Night3/06/20230
4423/04/20239:00:00 PMApril0.130.002579400.0108732Night4/06/20230
4523/04/20239:30:00 PMApril0.080.002553200.0113871Night5/06/20230
4623/04/202310:00:00 PMApril1.810.0035181.1880.0162422Night6/06/20230
4723/04/202310:30:00 PMApril0.560.00285170.2270.0147066Night7/06/20230
4823/04/202311:00:00 PMApril0.060.002528600.0166993Night8/06/20230
4923/04/202311:30:00 PMApril0.050.002518400.0244267Night9/06/20230
5024/04/202312:00:00 AMApril0.050.00252500.0264217Night10/06/20230
5124/04/202312:30:00 AMApril0.040.002518300.0176224Night11/06/20230
5224/04/20231:00:00 AMApril0.030.002517100.0117561Night12/06/20230
5324/04/20231:30:00 AMApril0.030.002509900.0101822Night13/06/20230
5424/04/20232:00:00 AMApril0.030.002524200.0096495Night14/06/20230
5524/04/20232:30:00 AMApril0.030.002520300.009065Night15/06/20230
5624/04/20233:00:00 AMApril0.040.002522500.0104555Night16/06/20230
5724/04/20233:30:00 AMApril0.520.00275450.4920.010187Night17/06/20230
5824/04/20234:00:00 AMApril0.580.00277590.5610.0095283Night18/06/20230
5924/04/20234:30:00 AMApril0.030.0025100.0088292Night19/06/20230
6024/04/20235:00:00 AMApril0.040.002508600.0089866Night20/06/20230
6124/04/20235:30:00 AMApril0.030.002502500.00862Day21/06/20230
6224/04/20236:00:00 AMApril0.030.002507500.008619Day22/06/20230
6324/04/20236:30:00 AMApril0.030.002496700.0089384Day23/06/20230
6424/04/20237:00:00 AMApril0.260.002657600.0089502Day24/06/20230
6524/04/20237:30:00 AMApril0.040.002509900.0081108Day25/06/20230
6624/04/20238:00:00 AMApril0.020.002495400.0075021Day26/06/20230
6724/04/20238:30:00 AMApril0.030.002505700.0073394Day27/06/20230
6824/04/20239:00:00 AMApril0.030.002521900.0073681Day28/06/20230
6924/04/20239:30:00 AMApril0.030.002512700.007348Day29/06/20230
7024/04/202310:00:00 AMApril0.030.002500.0073195Day30/06/202300
7124/04/202310:30:00 AMApril0.050.002524900.0088916Day
7224/04/202311:00:00 AMApril0.060.002536500.0174994Day
7324/04/202311:30:00 AMApril0.050.002531200.0180983Day
7424/04/202312:00:00 PMApril0.110.002580800.0171009Day
7524/04/202312:30:00 PMApril1.060.00297771.0390.0118035Day
7624/04/20231:00:00 PMApril0.030.002513600.0074745Day
7724/04/20231:30:00 PMApril0.030.002518600.0074936Day
7824/04/20232:00:00 PMApril0.030.002508700.0074808Day
7924/04/20232:30:00 PMApril0.030.002512800.0074739Day
8024/04/20233:00:00 PMApril0.030.002511200.0074822Day
8124/04/20233:30:00 PMApril0.050.002527600.0084156Day
8224/04/20234:00:00 PMApril0.100.002579500.0120772Day
8324/04/20234:30:00 PMApril0.080.002541100.0158852Day
8424/04/20235:00:00 PMApril0.090.002545800.0165709Day
8524/04/20235:30:00 PMApril0.070.002519500.0087714Day
8624/04/20236:00:00 PMApril0.120.002559400.0126284Day
8724/04/20236:30:00 PMApril0.040.002507600.014265Night
8824/04/20237:00:00 PMApril0.080.002552900.0147721Night
8924/04/20237:30:00 PMApril0.970.00295550.910.0151069Night
9024/04/20238:00:00 PMApril0.590.00275720.5380.017772Night
9124/04/20238:30:00 PMApril0.110.002564500.0547534Night
9224/04/20239:00:00 PMApril0.050.002526400.0074469Night
9324/04/20239:30:00 PMApril0.170.0026300.0116686Night
9424/04/202310:00:00 PMApril0.440.002835700.0146265Night
9524/04/202310:30:00 PMApril1.770.00352221.1050.1758211Night
9624/04/202311:00:00 PMApril0.640.002979500.5959358Night
9724/04/202311:30:00 PMApril0.630.002967700.5923983Night
9825/04/202312:00:00 AMApril0.620.002966700.5872993Night
9925/04/202312:30:00 AMApril0.620.002971300.5880947Night
10025/04/20231:00:00 AMApril0.620.002975800.5874463Night
10125/04/20231:30:00 AMApril0.620.002977200.58875Night
10225/04/20232:00:00 AMApril0.620.002979700.5882947Night
10325/04/20232:30:00 AMApril0.630.002982600.5894888Night
10425/04/20233:00:00 AMApril0.620.002954400.5852794Night
10525/04/20233:30:00 AMApril0.620.002958300.5848322Night
10625/04/20234:00:00 AMApril0.620.002955300.5839621Night
10725/04/20234:30:00 AMApril0.620.002954800.5832714Night
10825/04/20235:00:00 AMApril1.040.00314610.430.5806494Night
10925/04/20235:30:00 AMApril1.260.00324750.650.5799517Day
11025/04/20236:00:00 AMApril0.620.002947500.5808722Day
11125/04/20236:30:00 AMApril0.620.002950600.5809081Day
11225/04/20237:00:00 AMApril0.560.00291600.5242584Day
11325/04/20237:30:00 AMApril0.030.002520600.008287Day
11425/04/20238:00:00 AMApril0.030.002514800.0075339Day
11525/04/20238:30:00 AMApril0.030.002520600.0074777Day
11625/04/20239:00:00 AMApril0.030.002508800.0082486Day
11725/04/20239:30:00 AMApril0.270.002684700.0109457Day
11825/04/202310:00:00 AMApril0.040.002538300.0075778Day
11925/04/202310:30:00 AMApril0.060.002529600.0118121Day
12025/04/202311:00:00 AMApril0.150.002588900.0174284Day
12125/04/202311:30:00 AMApril0.150.002591900.0120194Day
12225/04/202312:00:00 PMApril0.070.002528600.0151272Day
12325/04/202312:30:00 PMApril0.050.002516900.0146566Day
12425/04/20231:00:00 PMApril0.070.002539200.0158785Day
12525/04/20231:30:00 PMApril0.060.002537800.0095145Day
12625/04/20232:00:00 PMApril0.050.002529200.0076191Day
12725/04/20232:30:00 PMApril0.290.00263050.2380.0077986Day
12825/04/20233:00:00 PMApril0.820.00287610.7290.00835Day
12925/04/20233:30:00 PMApril0.070.002533100.0076531Day
13025/04/20234:00:00 PMApril0.140.002584100.0143457Day
13125/04/20234:30:00 PMApril0.080.002527200.0174089Day
13225/04/20235:00:00 PMApril0.050.002498900.0090675Day
13325/04/20235:30:00 PMApril0.110.002545500.008308Day
13425/04/20236:00:00 PMApril0.090.002536100.0147016Day
13525/04/20236:30:00 PMApril0.080.002526400.0164469Night
13625/04/20237:00:00 PMApril0.030.00248800.0072961Night
13725/04/20237:30:00 PMApril0.030.002480300.0072905Night
13825/04/20238:00:00 PMApril0.050.002511300.0086264Night
13925/04/20238:30:00 PMApril0.880.00304980.4550.0128424Night
14025/04/20239:00:00 PMApril1.240.00326560.6030.0143852Night
14125/04/20239:30:00 PMApril0.130.002586600.0140178Night
14225/04/202310:00:00 PMApril0.110.002558100.0214334Night
14325/04/202310:30:00 PMApril0.080.00253800.0179559Night
14425/04/202311:00:00 PMApril0.060.002525200.0124389Night
14525/04/202311:30:00 PMApril0.040.002507300.0110014Night
Sheet1
Cell Formulas
RangeFormula
K2:K4K2=UNIQUE(C2:C3313)
L2:L70L2=UNIQUE(TRUNC(A2:A3313))
M2M2=SUMIFS($D$2:$D$3313,$A$2:$A$3313,K2,$H$2:$H$3313,$M$1)
M3:M31M3=SUMIFS($D$2:$D$3313,$A$2:$A$3313,L3,$H$2:$H$3313,$M$1)
N2:N70N2=SUMIFS($D$2:$D$3313,$A$2:$A$3313,L2,$H$2:$H$3313,$N$1)
A3:A145A3=A2+TIME(0,30,0)
H2:H145H2=IF((B2>=$I$1)*(B2<=$J$1),"Day","Night")
Dynamic array formulas.
 
This worked better than the SUMPRODUCT option. I just don't understand why my Sumifs formula stopped working for me.

=SUMIFS($D$2:$D$3313,$A$2:$A$3313,">="&L2,$A$2:$A$3313,"<"&L2+1,$H$2:$H$3313,$M$1)

i think bcos column A 45039 45039.02 45039.04 which is not 45039, so need to make 2 criterias if using sumifs

greater than 45039 (23/04/2023)
below 45040 (24/04/2023)

Another option
 
Last edited:
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I like Peter's solution.

Sumifs will also work. You can delete columns that are not necessary.

T202306a.xlsm
ADLMNO
1DateSum of Energy Consumed (kWh)DateDayNightTotal
2Sun 23-Apr-230.035551923-Apr-233.51563454.67689398.1925284
3Sun 23-Apr-230.035001724-Apr-232.12802547.35922419.4872495
4Sun 23-Apr-230.023185225-Apr-2311.0955484.689941315.78549
7c
Cell Formulas
RangeFormula
M2:M4M2=SUMIFS($D$2:$D$3313,$A$2:$A$3313,">="&L2,$A$2:$A$3313,"<"&L2+0.5)
N2:N4N2=SUMIFS($D$2:$D$3313,$A$2:$A$3313,">="&L2+0.5,$A$2:$A$3313,"<"&L2+1)
O2:O4O2=SUMIFS($D$2:$D$3313,$A$2:$A$3313,">="&L2,$A$2:$A$3313,"<"&L2+1)
 
Upvote 0
Can I ask a follow up question using the same data?
How would I find the sum of column D for each month in column K?
 
Upvote 0
Can I ask a follow up question using the same data?
How would I find the sum of column D for each month in column K?
Try something like this

MAP77.xlsm
CDKP
1MonthSum of Energy Consumed (kWh)Month
2April0.0355519April30.87611
3April0.0350017May2.589159
4April0.0231852
5April0.0791006
6April1.0545319
7April0.0320995
8April0.0321379
9April0.0284919
10April0.0223245
11April0.033248
12April0.0324642
13April0.0320961
14April0.0282338
15April0.0214574
16April0.0316914
17April0.0321544
18April0.0322769
19April0.0286294
20April0.0311428
21April0.3393994
22April0.9023672
23April0.0565942
24April0.309108
25April0.2623462
26April0.2149911
27April0.0828918
28April0.0569965
29April0.0542099
30April0.0498295
31April0.0383294
32April0.0330228
33April0.0967434
34April0.0578764
35April0.0565602
36April0.0562293
37April0.0430804
38April0.0324863
39April0.0324419
40April0.0323833
41April0.9860217
42April0.0336654
43April0.027637
44April0.1346338
45April0.0819659
46April1.8085687
47April0.5584434
48April0.0573794
49April0.0505064
50April0.0519052
51April0.0430055
52April0.0309592
53April0.0268022
54April0.0348959
55April0.034239
56April0.0352024
57April0.5215545
58April0.5799589
59April0.0282641
60April0.0350686
61April0.03316
62April0.0332616
63April0.0315303
64April0.2552311
65April0.035232
66April0.023317
67April0.0323566
68April0.0324556
69April0.0324587
70April0.0322083
71April0.0534659
72April0.0576323
73April0.0538605
74April0.1101797
75April1.0638283
76April0.0311013
77April0.0332243
78April0.0331147
79April0.0329457
80April0.0330121
81April0.0533725
82April0.1044134
83April0.0809677
84April0.0871692
85April0.0683305
86April0.1208185
87April0.038868
88April0.0814403
89April0.9736425
90April0.5946882
91April0.1064112
92April0.0510053
93April0.1746814
94April0.4366231
95April1.7741065
96April0.6422853
97April0.6329944
98April0.6231087
99April0.6237908
100April0.622918
101April0.6243223
102April0.6238122
103April0.6250102
104April0.6205129
105April0.620018
106April0.6191855
107April0.6184446
108April1.0412525
109April1.2580042
110April0.616047
111April0.6153449
112April0.5607891
113April0.027825
114April0.0262383
115April0.0297253
116April0.0323453
117April0.2671201
118April0.0432822
119April0.0600837
120April0.1507834
121April0.1455842
122April0.0679084
123April0.0536037
124April0.073528
125April0.0568942
126April0.050928
127April0.2922994
128April0.8228866
129April0.0689505
130April0.1413963
131April0.0772126
132April0.0514658
133April0.1129109
134April0.0939308
135April0.0773451
136April0.0298794
137April0.0296431
138May0.0458624
139May0.8780084
140May1.2371673
141May0.1330808
142May0.1079059
143May0.08058
144May0.0644748
145May0.0420789
kWh
Cell Formulas
RangeFormula
K2:K3K2=UNIQUE(C2:C145)
P2:P3P2=SUMIF(C2:C145,K2#,D2:D145)
Dynamic array formulas.
 
Upvote 0
Try something like this

MAP77.xlsm
CDKP
1MonthSum of Energy Consumed (kWh)Month
2April0.0355519April30.87611
3April0.0350017May2.589159
4April0.0231852
5April0.0791006
6April1.0545319
7April0.0320995
8April0.0321379
9April0.0284919
10April0.0223245
11April0.033248
12April0.0324642
13April0.0320961
14April0.0282338
15April0.0214574
16April0.0316914
17April0.0321544
18April0.0322769
19April0.0286294
20April0.0311428
21April0.3393994
22April0.9023672
23April0.0565942
24April0.309108
25April0.2623462
26April0.2149911
27April0.0828918
28April0.0569965
29April0.0542099
30April0.0498295
31April0.0383294
32April0.0330228
33April0.0967434
34April0.0578764
35April0.0565602
36April0.0562293
37April0.0430804
38April0.0324863
39April0.0324419
40April0.0323833
41April0.9860217
42April0.0336654
43April0.027637
44April0.1346338
45April0.0819659
46April1.8085687
47April0.5584434
48April0.0573794
49April0.0505064
50April0.0519052
51April0.0430055
52April0.0309592
53April0.0268022
54April0.0348959
55April0.034239
56April0.0352024
57April0.5215545
58April0.5799589
59April0.0282641
60April0.0350686
61April0.03316
62April0.0332616
63April0.0315303
64April0.2552311
65April0.035232
66April0.023317
67April0.0323566
68April0.0324556
69April0.0324587
70April0.0322083
71April0.0534659
72April0.0576323
73April0.0538605
74April0.1101797
75April1.0638283
76April0.0311013
77April0.0332243
78April0.0331147
79April0.0329457
80April0.0330121
81April0.0533725
82April0.1044134
83April0.0809677
84April0.0871692
85April0.0683305
86April0.1208185
87April0.038868
88April0.0814403
89April0.9736425
90April0.5946882
91April0.1064112
92April0.0510053
93April0.1746814
94April0.4366231
95April1.7741065
96April0.6422853
97April0.6329944
98April0.6231087
99April0.6237908
100April0.622918
101April0.6243223
102April0.6238122
103April0.6250102
104April0.6205129
105April0.620018
106April0.6191855
107April0.6184446
108April1.0412525
109April1.2580042
110April0.616047
111April0.6153449
112April0.5607891
113April0.027825
114April0.0262383
115April0.0297253
116April0.0323453
117April0.2671201
118April0.0432822
119April0.0600837
120April0.1507834
121April0.1455842
122April0.0679084
123April0.0536037
124April0.073528
125April0.0568942
126April0.050928
127April0.2922994
128April0.8228866
129April0.0689505
130April0.1413963
131April0.0772126
132April0.0514658
133April0.1129109
134April0.0939308
135April0.0773451
136April0.0298794
137April0.0296431
138May0.0458624
139May0.8780084
140May1.2371673
141May0.1330808
142May0.1079059
143May0.08058
144May0.0644748
145May0.0420789
kWh
Cell Formulas
RangeFormula
K2:K3K2=UNIQUE(C2:C145)
P2:P3P2=SUMIF(C2:C145,K2#,D2:D145)
Dynamic array formulas.
Thanks @Peter_SSs!
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
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