Sum if with date range

italy16

New Member
Joined
May 9, 2014
Messages
34
[TABLE="width: 500"]
<tbody>[TR]
[TD]Contract End Date[/TD]
[TD]amounts[/TD]
[/TR]
[TR]
[TD]
[TABLE="width: 500"]
<tbody>[TR]
[TD]1/2/14[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]2/5/14[/TD]
[TD]60[/TD]
[/TR]
[TR]
[TD]4/6/14[/TD]
[TD]70[/TD]
[/TR]
</tbody>[/TABLE]

Hello - I'm trying a sumif (I think) where I need to sum the "amounts" column if the contract end date is within a certain number of months from a beginning date. For example, how would I sum the "amounts" column if I wanted all contracts that started within 2 months of Jan. 1 2014? It should sum the 50+60 since they are in the range but not 4/6/14 since it is out of the 2 months window.

Thanks very much
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
If you have the start date in a cell say C1, you would use

=SUMIFS($B$2:$B$500,$A$2:$A$500,"<="&DATE(YEAR($C$1),MONTHS($C$1)+2,DAY($C$1))

I'm assuming the dates above are US format MM/DD/YY
Also, SUMIF and SUMIFS have different order of parameters, it's a good idea to ignore SUMIF and stick to SUMIFS, even if there's only 1 condition, in case you need to add conditions in the future.
You need to tweak the <= as needed to include or exclude contracts that finished before or on the date in C1

I've assumed your dates are in col A and amounts in col B. Also only rows down to 500, you need to adjust the references as needed
 
Last edited:
Upvote 0
Thank you. I'm getting a missing parentheses error (I'm using a Mac) - I can never figure out the parenthese thing :). Any ideas? Thanks in advance.

=sumifs(N14:N16,O14:O16,"<="&DATE(year(N12),months(N12)+2,day(N12))
 
Upvote 0
You just need one on the end. Usually Excel suggests one but it didn't on this occasion, sometimes it doesn't it there's lots of groups of brackets. I don't think using a Mac is the problem, it's just Excel.
=sumifs(N14:N16,O14:O16,"<="&DATE(year(N12),months(N12)+2,day(N12)))
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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