Try this formula

=IF(SUMPRODUCT(--(Sheet1!$A$1:$A$20=$B3),--(Sheet1!$C$1:$C$20=C$2))=0,"M","")