Unclear.
Cells can contain a value or a formula, not both.
If you enter 0 in A1 it will overwrite any previous formula the cell held.
If you want it to work this way you need to use VBA, of which I;m not an expert.'
Provide some examples to clarify what you are after.