I have column A with date values formatted as mm/dd/yyyy
. I am trying to sum the values of column B if A >=DATE(2012,1,1) AND
=SUM(B:B)
sums
You haven't got your SUMIF
in the correct order - it needs to be range, criteria, sum range. Try:
=SUMIF(A:A,">="&DATE(2012,1,1),B:B)
this works, and can be adapted for weeks or anyother frequency i.e. weekly, quarterly etc...
=SUMIFS(B12:B11652,A12:A11652,">="&DATE(YEAR(C12),MONTH(C12),1),A12:A11652,"<"&DATE(YEAR(C12),MONTH(C12)+1,1))
One more solution when you want to use data from any sell ( in the key C3
)
=SUMIF(Sheet6!M:M;CONCATENATE("<";TEXT(C3;"dd.mm.yyyy"));Sheet6!L:L)
I found another way to work around this issue that I thought I would share.
In my case I had a years worth of daily columns (i.e. Jan-1, Jan-2... Dec-31), and I had to extract totals for each month. I went about it this way: Sum the entire year, Subtract out the totals for the dates prior and the dates after. It looks like this for February's totals:
=SUM($P3:$NP3)-(SUMIF($P$2:$NP$2, ">2/28/2014",$P3:$NP3)+SUMIF($P$2:$NP$2, "<2/1/2014",$P3:$NP3))
Where $P$2:$NP$2
contained my date values and $P3:$NP3
was the first row of data I am totaling.
So SUM($P3:$NP3)
is my entire year's total and I subtract (the sum of two sumif
s):
SUMIF($P$2:$NP$2, ">2/28/2014",$P3:$NP3)
, which totals all the months after February and
SUMIF($P$2:$NP$2, "<2/1/2014",$P3:$NP3)
, which totals all the months before February.
To SUMIFS between dates, use the following:
=SUMIFS(B:B,A:A,">="&DATE(2012,1,1),A:A,"<"&DATE(2012,6,1))