Hi,

I beleive this would do it:

=IF(AND(B2="NO",OR(A1="ABC",A1="DEF")), A2,0)