I want to look down column D. If a cell if that column ="y", I want the formula to return the cell on column A in the same row. I want all these results in an unbroken list.

if I just use
=IF(D:D="y",A:A,"")

I get the results I want, but they display on the corresponding rows, skipping rows where the cell in D ="n". How can I solve this?

Thanks very much for any help!