I have two sheets in Google Spreadsheet
document. The first one has columns Month, Income, Expense and Profit (A,B,C,D respectively) and in each row expense value should be calculated based from filter (I think) from another sheet called Expenses.
The Expenses sheet contains columns Date, Name and Price.
So, what I need is to write formula to filter only expenses for specific month, to sum all prices in those rows and to write that value to C column (row for that month) in first sheet.
You can see this example and please help me out to solve this.
This is a formula that can be filled down (I have entered it in F2):
=ArrayFormula(SUMIF(TEXT(Expenses!A$2:A;"MMMM");A2;Expenses!C$2:C))
This is a formula that will automatically populate results down the column (I have entered it in G2):
=ArrayFormula(IF(LEN(A2:A);SUMIF(TEXT(Expenses!A2:A;"MMMM");A2:A;Expenses!C2:C);IFERROR(1/0)))
And this formula will take the year into consideration; I have entered it in J2, referencing month-year strings in I2:I:
=ArrayFormula(IF(LEN(I2:I);SUMIF(TEXT(Expenses!A2:A;"MMMM yyyy");I2:I;Expenses!C2:C);IFERROR(1/0)))