Is this for Excel or Google Sheets?

Try this:

=IF(ISNA(MATCH(A2,Sheet1!$A$2:$A$9,0)),"","Y")