You might want to make it a bit more robust by making sure it has been initialized for example by using As Constant() (or If(Row() == 1,....). In this case is wasn't necessary so I didn't bother with it
As Constant(flag = "");
If(Starts With(:Column 1, "Header"),
flag = :Column 1
);
flag;
Also the readability might improve with something like
As Constant(flag = "");
If(Starts With(:Header 1, "Header"),
flag = :Header 1
,
flag
)
You just want to "return" the value you wish to see in rows.
-Jarmo