How do I sum within a set time frame from the current date?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to figure out a way to add one column based on the date entered.
I need to write a formula that will calculate the past 6,12, and 24 months
from the current date.

Travis
 
SD
=SUMPRODUCT(--(A1:A18<=E1),--(A1:A18>(EDATE(E1,-6))),B1:B18)

Change the -6 to -12 and -24 for the other months


=SUMPRODUCT(--(A1:A18<=TODAY()),--(A1:A18>(EDATE(TODAY(),-6))),B1:B18)

Same formula, except the current date is today.
 
You need to :
1. calculate the times in the past
2. look then up in your table
3. sum between the end points

For the first part, is =TODAY() is in A1
then =DATE(YEAR(A1),MONTH(A1)-6,DAY(A1)) will be 6 months prior
then =DATE(YEAR(A1),MONTH(A1)-12,DAY(A1)) will be 12 months prior
then =DATE(YEAR(A1),MONTH(A1)-24,DAY(A1)) will be 24 months prior

you would then use MATCH() to find the entries or SUMIF() or SUMPRODUCT()
to get the correct sums
 
Thank you Don, you have been a tremendous help; I have been pulling my hair
out over this for some time.

Travis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top