I have list of dates and values:
01.01.2016 100
01.02.2017 200
01.03.2017 300
What i want is now if the the year is 2017 count the value. Result: 200 + 300 = 500
This is a formula i tried:
=SUMIF($F5:$F,"<="&$A2,AF5:AF)
The issue is that google sheet can not compare a date and a year. When i change the date from 01.02.2017 to 2017 it works.
If i try to get the year of the date it doesnt work:
=SUMIF(YEAR($F5:$F),"="&$A2,AF5:AF)
How can compare a date with a year? Or is there an other way?
Thanks!
SUMIF for the exact date You have two choices: 1) You can use a formula with the cell address. 2) You can write the date right into the formula. The date must be in the quotation marks.
Excel YEAR function=YEAR(A2) - returns the year of a date in cell A2. =YEAR("20-May-2015") - returns the year of the specified date.
Try this formula:
=SUM(FILTER(B:B,YEAR(A:A)=2017))
And also please try this:
=QUERY(A:B,"select year(A), sum(B) where A is not null group by year(A)")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With