I want to update a timestamp based on the last time any cell in a range is updated.

I added this script:

function getDate() {
  return new Date();

In a cell I use the formula:


It works, sort of. When I, or any user opens the sheet any cell with the formula updates to the current date. I don't want opening the sheet to count as an update, only if something in a cell in the range is actually changed.

How do I keep this from running on open, and only update when an actual change is made?

This is similar to a another question. I was starting with an approach here that I could not get to work correctly, the answers in the other thread used a different approach to solve a similar problem.

  • 1
    function getDate(onedit) { return new Date(); } – user0 Mar 4 '19 at 16:20
  • Thanks, user user0, that seems to work. – Ben Mar 8 '19 at 20:25