I have a Google spreadsheet that I've been working on. The attached link is a test sheet I work with before moving the script over to my sheet. Here's m problem, I don't fully understand the onEdit function. I'm wanting to include about five onEdit functions into one. However, when the second function runs the first function results are duplicated. Is there a way for the onEdit1 to run only once then for the onEdit2 function to run only once when onEdit3 runs? This is my function. Once I can get the first two functions to work, and not repeat the previous function each time, I'll add the additional functions.
function onEdit(e) {
trayOne(e);
trayTwo(e)
trayThree(e)
trayFour(e)
trayLCT(e)
}
function trayOne(e){
var ss = SpreadsheetApp.getActiveSheet();
var t1 = ss.getRange('H12').getValue();
var u1 = ss.getRange('I12').getValue();
var lim = '80000'
var lip = '10'
if(t1>lim&&u1>lip)
SpreadsheetApp.getUi().alert("It is recommended to replace Tray 1 feed and seporator
rolls.");
}
function trayTwo(e){
var sa = SpreadsheetApp.getActiveSheet();
var t2 = sa.getRange('H13').getValue();
var u2 = sa.getRange('I13').getValue();
var lim2 = '80000'
var lip2 = '10'
if(t2>lim2&&u2>lip2){
SpreadsheetApp.getUi().alert("It is recommended to replace Tray 2 feed and seporator
rolls.");
}
}
I'm new to app scripts so please be patient and explain how to accomplish this. Thank you in advance. Here is the link to my spreadsheet: https://docs.google.com/spreadsheets/d/1wkoZyCihUMEoGP9XOFnGuz_YFimgzAT_AKZ3binq9WA/edit#gid=0