Dynamically edited cell value is empty

I’m not sure that your requirements are even available.

All formulas have to defined previously on the data set.
Here is a link to demo with sum in the concrete cells - https://jsfiddle.net/9ut835po/

So you couldn’t dynamically act in formulas on the fly.