This is called a "Nested IF" function:

assuming your data is Cell A7, in B7 enter this formula:

=IF(A7=1,"Z",IF(A7=2,"Y","False"))

HTH