I have a spread sheet with two columns - first is date column and second is amount column. Now I am creating another two columns with name "No. of Transactions Based on Month" and "Total Amount Based on Month" respectively. Some cells of amount column are blank. Currently my sheet is like this:

[![enter image description here](https://i.stack.imgur.com/RggSe.png)](https://i.stack.imgur.com/RggSe.png)

Now, I am trying to add formulas which will automatically calculate number of transactions and total amount with respect to months.

My current formula to get No. of transactions are `=SUMPRODUCT(--(Month(A2:A7)=1))` for January and `=SUMPRODUCT(--(Month(A2:A7)=4))` for April. The problem with this approach is that they return 3 and 3 transactions whereas they should return 2 and 2 because 1 transaction is empty.

Likewise, the formula I am using to get total amount per month is `=SUM(B2:B4)` for January and `=SUM(B5:B7)` for April. The problem here is if we have 1000 transactions in every month then it will become headache to select cells. So I need formula which will automatically sum based on month.

What are the best approaches?