Google Spreadsheet conditional on three cells -
i've been trying implement conditional on spreadsheet, check-sheet 3 conditional cells "yes" or "no" in them. want achieve (using onedit) 1 3 cells contain "yes", enter next column date final yes entered. i've managed create other scripts work fine, 1 has me stumped.
thanks
since cells can edited individually, onedit need check of conditional cells' values, , write timestamp when "yes".
function onedit(event) { var conditionalcells = [ "b1", "b2", "b3" ]; // array of monitored conditionals var inlist = false; // assume edit outside of conditionals var allyes = true; // , values "yes". var sheet = event.source; // sheet edited var cell = event.range.geta1notation(); // range description // loop through conditionals checking contents. // verify edit triggered onedit() in 1 // of our conditional cells, setting inlist true if was. (var = 0; < conditionalcells.length && allyes; i++) { if (cell == conditionalcells[i]) inlist = true; allyes = (sheet.getrange(conditionalcells[i]).getvalue() == "yes"); }; // if our final yes, record date. // validating inlist, ensure record first time // conditionals "yes". if (inlist && allyes) sheet.getrange("c1").setvalue(new date()); }
Comments
Post a Comment