I have some trouble with a spreadsheet: as said in the title, I put in a column a formula which is calling a custom script based on the value of another cell, but when I modify this other cell, the formula does not update... This seems to work with standard formulas, but, in my cell calling my script:
- If I try to add a blank in the fomula cell, the result is still not updated.
- If I clear the formula cell, and re-type the formula, it's still showing the old value.
- If I copy paste the formula cell in another one, the new cell is up-to-date.
Here is my script. If few words: for given 'company' parameter, it search for all rows matching this criterion and store the 3rd column cell in a variable, finally returned ( so return the last value ):
function getLastStatut(company) {
var values = SpreadsheetApp.getActiveSheet().getDataRange().getValues();
var out = "not found";
var row;
for(i in values){
row = values[i];
if(row[1]==company){
out = row[2];
}
}
return out;
}
And for example:
- A1 : Date
- A2 : Test
- A3 : Running
- A4 : =getLastStatut(B1)
So A4 display "Running", but if I change A3, it still shows "Running", whereas it should display the value of A3.
Is this a bug or is there something I'm doing wrong? Any help is welcome.
Alexis