Reputation: 13
I got a sheet where I want to put the actual date on column "B1" only when I insert some text on column "A1". I did that using the IF and NOW formula but, as you may know, the date is automatically updated everytime and I want to prevent that (I dont want the date to be updated unless I edit "A1")
Is there a way to do that? Utilizing a script or something like that?
Thank you all everybody!
(I expect once the data is on the cell, it wont be updated anymore.)
Upvotes: 0
Views: 89
Reputation: 64140
Try this:
function onEdit(e) {
if(e.range.getSheet().getName()!='SomeSheetName') {return;}
if(e.range.columnStart==1 && e.value.length>0) {
e.range.offset(0,1).setValue(Utilities.formatDate(new Date(), Session.getScriptTimeZone(), "MM dd,yyyy HH:mm:ss"));
}
}
Upvotes: 1