we cant see whats in S3 or Z3 - better to use a sample spreadsheet - see yellow banner
The formula looks OK - it will depend if there is an ERROR in Z3

IFERROR should work

=IFERROR ( IF(,,,,,)) , "" )