Simplefying a formula with multiple SUMIF

20fleming

New Member
Joined
Feb 20, 2014
Messages
2
Hi all,


I've got a SUMIF formula that works but will be complex to expand. Junt wondering if there is a easier way of doing this is excel 2007

A10= SUMIFS(b2:b4,a2:a4,">="&B6,a2:a4,"<="&C6)+SUMIFS(d2:d4,c2:c4,">="&B6,c2:c4,"<="&C6)
result would be count of dates beween Apr1 - Apr 30. total =9

B10= SUMIFS(b2:b4,a2:a4,">="&c6,a2:a4,"<="&d6)+SUMIFS(d2:d4,c2:c4,">="&c6,c2:c4,"<="&d6)
result would be count of dates between May1 - May31. total= 6

the date range in row 6 will go on for 48 months

date1count1date2count2date3count3
4/3/1425/9/1414/15/144
5/8/1434/23/1425/19/142
4/9/1418/6/1511/1/151
date range1/4/141/5/141/6/141/7/141/8/14

<TBODY>
</TBODY>
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi 20fleming,

can't you reshuffle your data, so it's all in one column? That would make your formula much easier...

Greets,

Koen
 
Upvote 0
You should be able to use a single SUMIFS like this

=SUMIFS($b2:$z4,$a2:$y4,">="&B6,$a2:$y4,"<="&C6)

Notice how the ranges are "offset" by one column from each other. This works as long as the "counts" are relatively low values so that they can't be mistaken for dates
 
Upvote 0
Thank you both for your suggestions. I've put all of the data in 1 column on another tab and done a vlookup as I can't change the formatting. Barry, thanks for your suggestion. unfortunately my number do get into high values.
 
Upvote 0
If I understand correctly what you want, maybe this can helps:

Code:
=SUM(SUMIFS(OFFSET($B$2:$B$4,,2*{0,1,2}),OFFSET($A$2:$A$4,,2*{0,1,2}),">="&OFFSET($B$6,,2*(ROW($1:$24)-1)),OFFSET($A$2:$A$4,,2*{0,1,2}),"<="&OFFSET($C$6,,2*(ROW($1:$24)-1))))

Markmzz
 
Upvote 0
Barry, thanks for your suggestion. unfortunately my number do get into high values.

OK, assuming you do really have headers that say "date1", "count1" etc. then this formula will do what you want, with no confusion possible between date and count values

=SUMPRODUCT(($a2:$y4>=B6)*($a2:$y4<=C6)*(LEFT($A1:$Y1,4)="date"),$B2:$z4)

extend ranges as required
 
Upvote 0
A small modification in my formula:

Code:
Use Ctrl+Shift+Enter and not only Enter to enter the formula

=SUM(SUMIFS(OFFSET($B$2:$B$4,,2*{0,1,2}),
OFFSET($A$2:$A$4,,2*{0,1,2}),">="&SUMIF(OFFSET($B$6,,ROW($1:$24)-1),"<>"),
OFFSET($A$2:$A$4,,2*{0,1,2}),"<"&SUMIF(OFFSET($C$6,,ROW($1:$24)-1),"<>")))

Markmzz
 
Upvote 0

Forum statistics

Threads
1,216,119
Messages
6,128,947
Members
449,480
Latest member
yesitisasport

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