SUMIF not working for multiple coloumns whats the best excel solution?

SimonVOwen

New Member
Joined
Nov 15, 2017
Messages
26
Hello All,

I regularly have to deal with Half Hour data spanning a year. So a table 48 by 365.
In this data I need to sum certain dates / times as they have different rates.
Ideally I would want a solution where SUMIF would work across the multiple columns but I am unsure if this can be done or how to proceed.
=SUMIFS(B18:K29,A18:A29,">="&5,B17:K17,">="&5,B17:K17."<="&7)
As a base example of the code I would be trying to run would be like this which returns #value as it cannot cope with B18:K29.
Below is an example of how the data would look and the red section I am trying to sum.
I need to do this for roughly 6/7 areas in the large data setts and they all vary in size.
Any help would be much appreciated.

Regards,

Simon Owen
12345678910Half hour Segments
10.03870.03750.03420.0330.03170.03220.03070.03030.03130.0316
20.0380.03660.03120.03110.03480.03060.03570.03260.03070.0355
30.04030.03730.03420.03370.03280.03140.03130.03170.03150.0321
40.03560.0320.02970.02920.02850.02830.02770.02790.0290.0295
50.03440.03150.02940.02840.0280.02750.02740.02730.02850.0296
60.03480.0320.02960.02840.02810.02790.02710.0270.02840.0294
70.03490.03140.02940.02890.02860.02770.02720.02750.02870.0292
80.03350.0340.03020.02820.02980.02830.02770.02960.02810.0312
90.03550.03140.030.02890.02930.02830.02610.02850.02750.0276
100.03520.03130.0290.02840.02740.0270.02670.02720.02790.0287
110.0350.03140.0290.02850.02770.02760.0270.02740.02840.0289
120.03420.03130.0290.0280.02740.02690.02690.02690.02810.0292

<tbody>
</tbody><colgroup><col><col span="10"><col></colgroup>
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi, welcome to the forum!

Here is one possible option you can try:


Excel 2013/2016
ABCDEFGHIJKLM
112345678910
210.03870.03750.03420.0330.03170.03220.03070.03030.03130.03160.6636
320.0380.03660.03120.03110.03480.03060.03570.03260.03070.0355
430.04030.03730.03420.03370.03280.03140.03130.03170.03150.0321
540.03560.0320.02970.02920.02850.02830.02770.02790.0290.0295
650.03440.03150.02940.02840.0280.02750.02740.02730.02850.0296
760.03480.0320.02960.02840.02810.02790.02710.0270.02840.0294
870.03490.03140.02940.02890.02860.02770.02720.02750.02870.0292
980.03350.0340.03020.02820.02980.02830.02770.02960.02810.0312
1090.03550.03140.030.02890.02930.02830.02610.02850.02750.0276
11100.03520.03130.0290.02840.02740.0270.02670.02720.02790.0287
12110.0350.03140.0290.02850.02770.02760.0270.02740.02840.0289
13120.03420.03130.0290.0280.02740.02690.02690.02690.02810.0292
Sheet1
Cell Formulas
RangeFormula
M2=SUM(INDEX($B$2:$K$13,MATCH(5,$A$2:$A$13,0),MATCH(5,$B$1:$K$1,0)):INDEX($B$2:$K$13,MATCH(12,$A$2:$A$13,0),MATCH(7,$B$1:$K$1,0)))
 
Upvote 0
Hi FormR,

Thanks a lot for the help!! (very much appreciated)
Recently I have been running into the index/match concept a couple of times but wasn't sure how to utilise as hadn't used before.
I have been reading these forums for years now and this was first time I had to actually had to ask a question as usually I could solve my issues from previous posts.

Regards,
Simon
 
Upvote 0
Hi, glad it helped - and on reflection we may even get away with this instead:


Excel 2013/2016
ABCDEFGHIJKLM
112345678910
210.03870.03750.03420.0330.03170.03220.03070.03030.03130.03160.6636
320.0380.03660.03120.03110.03480.03060.03570.03260.03070.0355
430.04030.03730.03420.03370.03280.03140.03130.03170.03150.0321
540.03560.0320.02970.02920.02850.02830.02770.02790.0290.0295
650.03440.03150.02940.02840.0280.02750.02740.02730.02850.0296
760.03480.0320.02960.02840.02810.02790.02710.0270.02840.0294
870.03490.03140.02940.02890.02860.02770.02720.02750.02870.0292
980.03350.0340.03020.02820.02980.02830.02770.02960.02810.0312
1090.03550.03140.030.02890.02930.02830.02610.02850.02750.0276
11100.03520.03130.0290.02840.02740.0270.02670.02720.02790.0287
12110.0350.03140.0290.02850.02770.02760.0270.02740.02840.0289
13120.03420.03130.0290.0280.02740.02690.02690.02690.02810.0292
Sheet1
Cell Formulas
RangeFormula
M2=SUM(INDEX($B$2:$K$13,5,5):INDEX($B$2:$K$13,12,7))
 
Upvote 0
Hello again,

I have the same dataset that I have used the code for as above to generate the sum value.
However I now have a condition that I need to split out the weekends which are represented in the first column as 1 (weekend) and 0 (day)
I have tried to add a simple IF in front of the sum Index but this would not appear to work as I would like.
What would be the best way to incorporate a condition on a sum index or would I need to incorporate Match?
I have not done a Index/Match before can anyone assist with this?
ABCDEFGHIJKLM
11 12345678910
1210.03870.03750.03420.0330.03170.03220.03070.03030.03130.0316 0.6636
0320.0380.03660.03120.03110.03480.03060.03570.03260.03070.0355
0430.04030.03730.03420.03370.03280.03140.03130.03170.03150.0321
0540.03560.0320.02970.02920.02850.02830.02770.02790.0290.0295
0650.03440.03150.02940.02840.0280.02750.02740.02730.02850.0296
0760.03480.0320.02960.02840.02810.02790.02710.0270.02840.0294
1870.03490.03140.02940.02890.02860.02770.02720.02750.02870.0292
1980.03350.0340.03020.02820.02980.02830.02770.02960.02810.0312
01090.03550.03140.030.02890.02930.02830.02610.02850.02750.0276
011100.03520.03130.0290.02840.02740.0270.02670.02720.02790.0287
012110.0350.03140.0290.02850.02770.02760.0270.02740.02840.0289
013120.03420.03130.0290.0280.02740.02690.02690.02690.02810.0292


<colgroup><col width="64" style="width: 48pt;" span="15">
<tbody>














































































































































































































































</tbody>
 
Upvote 0
Assuming numbers in C18:L29 (as per your first post but just moved across one column) then you can solve your original problem with this formula

=SUMPRODUCT((C17:L17>=5)*(C17:L17<=7)*(B18:B29>=5),C18:L29)

Then to incorporate a weekend/weekday condition that's just another condition added to that, e.g.

=SUMPRODUCT((C17:L17>=5)*(C17:L17<=7)*(B18:B29>=5)*(A18:A29=1),C18:L29)
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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