S1 cell will show the header (that's why I put a background color).
S2-end cells (up to the end of columns) will show formula result. My goal is to check when if S2 then fill according to Z2, if S3 then fill according to Z3.
About overwriting the S,... I don't see what you mean.