I need my team to enter their names in Column A, LOGIN or LOGOUT in Column B, and I need the login timestamp in Column C and logout timestamp in Column D. I need this repeated for 30 days (a month) in every sheet, which means that Columns B, C, and D will repeat 30 times across the sheet.
Name - LOGIN/LOGOUT - LOGIN-Timestamp - LOGOUT-Timestamp
I found this code in YouTube (slightly tweaked), which creates two timestamps in 2nd and 3rd columns, where the second one updates to a new time, when column 1 is updated, while the first remains unchanged. I planned to use this by hiding the second timestamp (using conditional formatting) when the user enters LOGIN, and then unhide it when the user enters LOGOUT. However, I do not know how to have this script called to every 4th column for subsequent days. I have spent nearly the entire day figuring this out, but my script know-how is extremely limited. Any help is greatly appreciated. Many thanks.
function onEdit(e) {
var row = e.range.getRow();
var col = e.range.getColumn();
if(col === 1 && row >= 1 && e.source.getActiveSheet().getName() === "Test"){
var currentDate = new Date();
e.source.getActiveSheet().getRange(row,3).setValue(currentDate);
if(e.source.getActiveSheet().getRange(row,2).getValue() == ""){
e.source.getActiveSheet().getRange(row,2).setValue(currentDate);
}
}
}