Possibly?

=IF(A2="Y",IF(B2>2,1,0),IF(B2>1,1,0))