Sum amounts between dates

F

fuzit

I have four columns. One is the date. The second is an amount for tha
day. In the third (12 month) and fourth (24 month) column I want to su
the amounts in the second column based on the dates in the firs
column.

I was attempting to convert the following formula by changing it t
countif the date is BETWEEN Now() and 12/24 months ago. Unfortunatel
I'm not that good at this.

Here is the initial formula but I am willing to take any ideas o
this:
=SUM(OFFSET(B2,1,0,COUNTIF($A$3:$A$22,"<="&NOW()),1))

Many thanks in advance
 
F

Frank Kabel

Hi
try
=SUMPRODUCT(--(A3:A22<=NOW()),--(A3:A22>DATE(YEAR(NOW())-1,MONTH(NOW())
,DAY(NOW())),B3:B22)
 
F

fuzit

Thanks Frank,
Here is the final formula I used:

=SUMPRODUCT(--($A$3:$A22<=$A22),--($A$3:$A22>DATE(YEAR($A22)-1,MONTH($A22),DAY($A22))),$B$3:$B22)

I added a parantheses prior to the last comma and change the no
references to the cell reference.

I ran a test and manually verified and it works awsome. many Thank
 

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

Top