This is a simplification of my data:

A | B | C | D | |

1 | 04.01.2013 | 340 | Transportation | All |

2 | 10.02.2014 | 460 | House | |

3 | 23.02.2014 | 200 | Food | |

4 | 17.03.2013 | 340 | Power | |

5 | 24.03.2014 | 500 | House | |

6 | 24.03.2014 | 25 | Transportation | |

7 | 01.07.2014 | 123 | Food | |

8 | 21.08.2013 | 320 | Cloths | |

9 | 25.08.2014 | 105 | Transportation | |

10 | 28.08.2014 | 150 | Power |

<tbody>

</tbody>

Input field:

D1. Month values: All, 1-12

MONTH function can only use 1 to 12 for January to December, but I would like to also select the sum of the whole year. So this is what I've come up with so far.

=IF(D1="All";(SUMPRODUCT((YEAR(A1:A10)=2014)*(B1:B10)));(SUMPRODUCT((YEAR(A1:A10)=2014)*(MONTH(A1:A10)=D1)*( B1:B10))))

This gives me the sum (1563) for the whole year of 2014. It also gives me value for individual months if needed. But I have left out the Expense type here. So, I tried to add this.

=IF(D1="All";SUMPRODUCT((YEAR(A1:A10)=2014)*(SUMIF(C1:C10;"Power";B1:B0)));(SUMPRODUCT((YEAR(A1:A10)=2014)*(MONTH(A1:A10)=D1)*( B1:B10))))

This gives me the value of 3430. Instead of adding the numbers, it seems like there is some multiplication going on here. It should give me the value 150. Preferably.

I could of-course add two sheets. One for the whole year, and one for individual months. But I would very much like to have just one sheet for the whole thing. My head is spinning. Hopefully some of you have some suggestions on how to handle this.

Thanks!