Don't use full columns. Just use a range that easily exceeds the maximum you might ever use. For example, say the max is 5000 rows in col A. Then you could use this in cell C2:
=IF($A2="","",SUMPRODUCT((MONTH($A$2:$A$6000)=MONTH(C2))*($B$2:$B$6000="Yes")))
drag the formula down to A6000.
Don't use full columns. Just use a range that easily exceeds the maximum you might ever use. For example, say the max is 5000 rows in col A. Then you could use this in cell C2:
=IF($A2="","",SUMPRODUCT((MONTH($A$2:$A$6000)=MONTH(C2))*($B$2:$B$6000="Yes")))
drag the formula down to A6000.
BTW: this will count all "Yes" entries in the particular month, regardless of year. If you may have multiple year values included in the dates in col A and you only wish to count those in say 2021 you need to add another condition, like this:
=IF($A2="","",SUMPRODUCT((MONTH($A$2:$A$6000)=MONTH(C2))*(YEAR($A$2:$A$6000)=YEAR(C2))*($B$2:$B$6000="Yes")))
BTW: this will count all "Yes" entries in the particular month, regardless of year. If you may have multiple year values included in the dates in col A and you only wish to count those in say 2021 you need to add another condition, like this:
=IF($A2="","",SUMPRODUCT((MONTH($A$2:$A$6000)=MONTH(C2))*(YEAR($A$2:$A$6000)=YEAR(C2))*($B$2:$B$6000="Yes")))