(Administrators: Please let me post as I decide it’s reasonable. Don’t gues similarity of an answer to a previously tried -and then removed- comment. It’s annoying. Who had thought the new software the site was moved to would even be worse than the old one. Much too many pseudo-smart features.)
This is not exactly an answer because it isn’t defining/using an event handler, but works with ordinary formulas. The starting function may, however be easily replaced by an event handling Sub introducing some needed adaptions. In addition it’s only made for “values” (whether numeric or string). To memorize formulas you need to make them string results in the watched cells. Anyway I would suggest to forget about event handling in the current context. Too much overhead.
Years ago I wasted a lot of time trying to find ways to get history awareness by standard formulas. I came to the conclusion that it can’t be done in a reliable way.
However, when recently there was another question concerning “previous values” I tried to find a definite solution not needing an asignment to an event handler (onContentChanged), but triggered by an ordinary formula based on a UserDefinedFunction.
The attached .ods
has a first sheet basically made (formatted) by the questioner of the mentioned thread. The second sheet -needed as extra memory- is hidden (and should only made visible for studies).
Only the range Sheet1.D5:D11
is watched and memorized in the example. It uses 11 columns of the respective rows for a deep shiftregister cointaining 10 previous values, and you can’t simply add watched ranges without thorough considerations therefore.
shiftRegisterNotListening.ods (21.2 KB)