Getting difference between time stamps
playing with code
function checkCompleted() {
var s = SpreadsheetApp.getActive().getSheetByName('Timestamps');
s.getRange('D2:E').getValues().forEach (function (r, i) {
if(r[0] == '2' && !r[1]){
s.getRange(i + 2, 5).setValue(new Date())
} else if (r[0] == '1'){
s.getRange(i + 2, 5).clearContent()
}
}
)}
For context a checkbox is used for Column D if checked its true if unchecked its false if that column - = 2
get the range and set a date and if it = 1
clear the date this is used as a way to see time differences between when the boxes are checked and unchecked.
My question is although I found a formula that works I do not understand the i+2
I understand column 5 is where the timestamp is and but am unclear on the i+2
part
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.