Answer the question
In order to leave comments, you need to log in
How in Google sheets so that when the checkbox is changed, the time of clicking on the checkbox is set?
There are flags on F3:F5.
On cells G3:G5, where the time of changing the value of the flag from FALSE - TRUE should fit.
I tried to make the formula "IF(F4=TRUE;NOW();"End time")", with one pair it works, but when the page is updated, it updates cell G3
Or when the checkbox in cell F4 is checked, the time in the remaining cells changes .
I would like to make them independent of each other. As I understand it, you need to use scripts, but I'm not good at them :(
Answer the question
In order to leave comments, you need to log in
Use function onEdit(event) to determine if a cell has changed.
event.source.getActiveRange().getA1Notation() to determine cell address
Below is the code to check sheet "Sheet1" and cell "A1" in it.
function onEdit(event){
var as = event.source.getActiveSheet();
if ((event.source.getActiveRange().getA1Notation()=="A1")&&(as.getName()=="Лист1")&&(event.source.getActiveRange().getValue()===true)){
as.getRange("B1").setValue("Флажок установлен "+formatDateTime(new Date()));
};
};
function formatDateTime(date) {
var dd = date.getDate();
if (dd < 10) dd = '0' + dd;
var mm = date.getMonth() + 1;
if (mm < 10) mm = '0' + mm;
var yy = date.getFullYear() % 100;
if (yy < 10) yy = '0' + yy;
var hh = date.getHours();
if (hh < 10) hh = '0' + hh;
var MM = date.getMinutes();
if (MM < 10) MM = '0' + MM;
var ss = date.getSeconds();
if (ss < 10) ss = '0' + ss;
return dd + '.' + mm + '.' + yy + ' ' + hh + ':'+ MM + ':'+ ss;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question