I have some code that will only execute upon save (not even upon manual RUN, but only on Save). The code is a commission calculator... designed to compute assign 3 variables... X, Y, and Z that store 13%, 14%, and 15% respectively of the gross profit value stored in B13.
Right now I have it just returning X as a method to check that the v script was working. It does in fact work, but does not run OnEdit, as I have setup my triggers to do. It instead only runs when I click Save on the script editor.
Any help appreciated.
function myFunction() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('Sheet1');
var range = sheet.getRange("B13");
var data = range.getValue();
var a=(data*.13);
var b=(data*.14);
var c=(data*.15);
if(a<=150)
{(X=150);}
if(a>150)
{(X=a);}
if(b<=150)
{(Y=150);}
if(b>150)
{(Y=b);}
if(c<=150)
{(Z=150);}
if(a>150)
{(Z=c);}
return X;
}