Sum by date
I'm not sure if you only want to check for dates up to 6 months in the
future, or in the past also. Either way, to calculate the date 6 months from
now, paste this into an out-of-the-way cell:
=DATE(IF(MONTH(NOW())6,YEAR(NOW())+1,YEAR(NOW())) ,IF(MONTH(NOW())6,MONTH(NOW())-6,MONTH(NOW())+6),DAY(NOW()))
If you only want to check for future dates, start with a formula like this
in column B:
=SUMPRODUCT(--(C5:C1000<=$A$1),E5:E1000)
In this example, the date 6 months from today is found in cell AA1. Add as
many copies of the SUMPRODUCT formula as necessary to itself, editing the
column references each time. For example:
=SUMPRODUCT(--(C5:C1000<=$A$1),E5:E1000)+SUMPRODUCT(--(F5:F1000<=$A$1),H5:H1000)
Empty cells in the date columns won't cause problems, but text that Excel
can't interpret as a date will. Therefore, the format of your dates might
mean we need to adjust the formula.
If you want to look for past dates within 6 months as well as future dates,
then you can use something like this:
=SUMPRODUCT(--(ABS(C5:C1000-NOW())<=ABS($A$1-NOW())),E5:E1000)
Hope this helps,
Hutch
"hmsawyer" wrote:
In column B, I am trying to add up the values in columns E, H, K, etc (every
third column), but ONLY if the corresponding date in columns C (for E), F
(for H), I (for K), etc (every third column) is within 6 months from TODAY.
I can move the data around if the values need to be next to the corresponding
dates, but that will move around some list validations I already have set up,
so I'm trying to avoid it if possible.
I think it is a sum if, but I can't get it to work. Any help is
appreciated. Thank you so much!
|