Hi
Try this in B7 -
Code:
=SUM((Sheet1!$E3:$E14)*(Sheet1!$H3:$H14=$A$2)*(Sheet1!$I3:$I14=A7)*(Sheet1!$A3:$A14>=DATE(2011,COLUMNS($B$1:B1),1))*(Sheet1!$A3:$A14<=DATE(2011,COLUMNS($B$1:B1)+1,0)))
and drag across.
Generally, if you need a value to increase going across the sheet use COLUMNS, going down the sheet use ROWS.
hth
This works perfectly, thanks.
Now for my next question:
I need that array formula to be applied across multiple sheets and summed. This is because I need to be able to calculate income and expenses across multiple accounts. For example, a complete formula for cells B7:M7 would look like this:
=SUM(
SUM((Sheet1!$E3:$E14)*(Sheet1!$H3:$H14=$A$2)*(Sheet1!$I3:$I14=$A7)*(Sheet1!$A3:$A14>=DATE(2011,COLUMNS($B$1:B1),1))*(Sheet1!$A3:$A14<=DATE(2011,COLUMNS($B$1:B1)+1,0))),
SUM((Sheet2!$E3:$E14)*(Sheet2!$H3:$H14=$A$2)*(Sheet2!$I3:$I14=$A7)*(Sheet2!$A3:$A14>=DATE(2011,COLUMNS($B$1:B1),1))*(Sheet2!$A3:$A14<=DATE(2011,COLUMNS($B$1:B1)+1,0))),
SUM((Sheet3!$E3:$E14)*(Sheet3!$H3:$H14=$A$2)*(Sheet3!$I3:$I14=$A7)*(Sheet3!$A3:$A14>=DATE(2011,COLUMNS($B$1:B1),1))*(Sheet3!$A3:$A14<=DATE(2011,COLUMNS($B$1:B1)+1,0)))
)
Where Sheet1, Sheet2, and Sheet3 are separate accounts.
First of all, is that even possible? Can I have a formula that is a sum of array formulas? (UPDATE: Yes, the above formula works just fine as an array formula and gives the correct result)
Second, is there any way to do this that would be easier than copying and pasting in the giant formula above, and then using the autofill to update all other cells? I ask because if I add a new account, that is the only way I would know how to update all of the cells. If I wanted to add a Sheet4, I would need to copy the above formula from one of the cells, copy the Sheet3 line, paste it, change all references to Sheet3 to Sheet4, paste the formula back into the cell, and then use autofill to update all other cells.
Is there any way to just keep a list of the sheet names, and tell Excel to apply the formula across all sheets whose name is contained within that list?