I just encountered some weird thing ... but can't really find the reason... I used google apps script and tried to compare the values by using for() and if(). The weird thing is that.. Even though the code that I used is same, the results were different.
I got four 'A's when compared the B column but no results(logs) when compared D column..
For better understanding, I put data capture and my codes below.. Could anyone help me to solve this issue?
function leaveM(){
var log = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('abc');
//get 'B' column's last text value
var name = log.getRange(log.getLastRow(),2).getValue();
//get 'D' column's last date value
var addDate = log.getRange(log.getLastRow(),4).getValue();
var data = log.getDataRange().getValues();
for(var u=1; u<data.length; u++){
if(data[u][1] == name){
Logger.log(data[u][1]);
}
}
for(var u=1; u<data.length; u++){
if( data[u][3] == addDate){
Logger.log(data[u][3]);
}
}
}