Try:

=IF(SUMPRODUCT(--('Sheet 2'!$A$1:$A$7=A2),--('Sheet 2'!$B$1:$B$7=3)),"Yes","No")

where data starts in A2 of Sheet 1 and database is in Sheet 2, A1:B7

adjust as necessary