There is a pretty simple way to do this with the sumifs() function. First though, it is always a good idea to enter dates as dates. When you do that, you can use a myriad of date functions on the dates that allow you to get things like the day, year, and month from any date.
That said, here is all you would need to do given your data:
- In column D, enter this formula =LEFT(A1,2) and copy it down.
- In cell F2, enter this formula =SUMIFS(B:B,C:C,$F$1,D:D,LEFT(E2,2)) and copy it down.
- In cell G2, enter this formula =SUMIFS(B:B,C:C,$G$1,D:D,LEFT(E2,2)) and copy it down.
If you follow these steps, you should get the desired result.
hope this helps