Reputation: 198
Before making this post, I have read the following posts:
And the following websites' pages:
What I try to do is just to do a conditional sumation between the elements of a range contained in a column if they meet the condition of being within a month. The setup of my sheet is the following:
And I have tried the following functions (A6 is a cell that contains a Date):
All attempts return me a "Formula Parse Error" with the code #ERROR (Meaning Google Sheets cannot make sense of the formula you have written). I honestly don't know where is my error, whether I pass incorrect parameter types or forget to add braces, commas, etc.
Upvotes: 1
Views: 6512
Reputation: 2851
The first formula you propose (the one using SUMPRODUCT
) actually works for me. And actually the double negation is not even necessary. You may have problems if you have empty dates so you may just add a ISDATE(DATES)
in the condition, like so:
=SUMPRODUCT(EXPENSES; ISDATE(DATES)*MONTH(DATES)=MONTH(A6))
Also note that a syntax error could be caused by your locale. Note that I'm using a semicolon ;
instead of a comma ,
because in my locale commas are used as the decimal separator. Something similar might be happening to you.
Upvotes: 3
Reputation: 10573
Please try one of the following formulas
(where A2:A
is your dates range, A1
is your date and C2:C
is your expenses range)
If all dates are within the same year try
=ArrayFormula(SUMIF(MONTH(A2:A),"="&MONTH(A1),C2:C))
If you have different years use
=ArrayFormula(SUMIF(MONTH(A2:A)&YEAR(A2:A),"="&MONTH(A1)&YEAR(A1),C2:C))
Upvotes: 0