formula – conditional return on a column containing "Yes"

Solution 1:

Since you say “checking the date above the cell”, and “the current month” is in AJ5, I assume that the “Yes” (or something else) is in AJ6.  The general way to do what you seem to be asking for is simply to use a compound IF; i.e., an IF within an IF, like this:

=IF(AJ6="Yes",  IF(AND(AJ$5>=$H24,AJ$5<=$I24),$J24,0),  0)

But, in this case, since the formula you already have is an IF with the same “else” value (0) — and it contains an AND — you can simplify it a little:

=IF(AND(AJ6="Yes",AJ$5>=$H24,AJ$5<=$I24),$J24,0)

You haven’t explained why you use $s some places but not others.  I’ll assume that you know what you’re doing, and leave it to you to figure out whether you need to use AJ6, AJ$6, $AJ6 or  $AJ$6