It works as follows: Identify the value just edited is "Completed"or "Cancelled". If true, select the "Timestamp" value in previous column. Lookup the "Timestamp" in a different tab called "mainSheet". When found, write the value in the 59th column of that row. The code works until the if(sheetCells[i][0]===TimeStamp) condition where it cannot compare the cell and assign value of i to rowValue. I've run the Logger inside the loop and it DOES have same values! Am I missing something here?
function onEdit(e){
var completed = "Completed";
var cancelled = "Cancelled"
var s = SpreadsheetApp.getActiveSheet();
var value = s.getActiveCell().getValue();
if(value == completed || value == cancelled){
    var statusColumn = 59, rowValue=0;
    var TimeStamp = SpreadsheetApp.getActiveRange().offset(0,-1).getValue();
    var mainSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Form Responses 1");
    var sheetCells = mainSheet.getDataRange().getValues();
    for(var i=1; i<sheetCells.length; i++){
        Logger.log(sheetCells[i][0]+" "+TimeStamp);
        if(sheetCells[i][0]===TimeStamp){
            rowValue = i;
        }
    }
    //sheetCells[rowValue][statusColumn].setValue(value);
    Logger.log(rowValue);
}
}
 
     
    