1

I'm new to writing/using scripts. I want to use something to allow for multiple cells to be updated and tracked for the last time they were modified. I've tried various different scripts on here but so far I'm struggling!! I'd really appreciate some help/guidance on how to say if cell M / N / O are modified then the last date that happened ends up in V / W / X.

0
  • try like this:

    function onEdit(e) {
    var s = SpreadsheetApp.getActiveSheet();
    if( s.getName() == "Sheet3" ) { 
    var r = s.getActiveCell();
    if( r.getColumn() == 13 ) { 
      var nextCell = r.offset(0, 9);
      var newDate = Utilities.formatDate(new Date(), 
      "GMT+8", "MM/dd/yyyy hh:mm:ss");
      nextCell.setValue(newDate);
    }
    if( r.getColumn() == 14 ) { 
      var nextCell = r.offset(0, 9);
      var newDate1 = Utilities.formatDate(new Date(), 
      "GMT+8", "MM/dd/yyyy hh:mm:ss");
      nextCell.setValue(newDate1);
    }
    if( r.getColumn() == 15 ) { 
      var nextCell = r.offset(0, 9);
      var newDate1 = Utilities.formatDate(new Date(), 
      "GMT+8", "MM/dd/yyyy hh:mm:ss");
      nextCell.setValue(newDate1);
    }
    }
    }

  • "Sheet3" = sheet name

  • r.getColumn() == 13 = column M / 13th column
  • r.offset(0, 9) = offset timestamp 9 columns to the right on the same row eg column V
  • "GMT+8" = timezone
  • "MM/dd/yyyy hh:mm:ss" = date and time format

    0

  • 1
    Perfect! Thank you so much! – Nick May 29 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.