Try this (note you need an empty top line (edit: in fact, you have a header line in order)):
=IF(A2<>A1,A2,IF(D2<>D1,A2,"")) =IF(A2<>A1,B2,IF(D2<>D1,B2,"")) =IF(A2<>A1,C2,IF(D2<>D1,C2,"")) etc
in the top row and drag down
Edit: Noticed that you need an additional condition.
source share