Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

208
Views
Copy row when cell contains "x" with another condition to meet

Spreadsheet screenshotI have a script from one of the old topics to copy row when a certain value is in a cell:

  
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = event.source.getActiveSheet();
  var r = event.source.getActiveRange();
  if(s.getName() == "Stock" && r.getColumn() == 4 && r.getValue() <= 5) {
    var row = r.getRow();
    var numColumns = s.getLastColumn();
    var targetSheet = ss.getSheetByName("Orders");
    var target = targetSheet.getRange(targetSheet.getLastRow() +1, 1);
    s.getRange(row, 1, 1, numColumns).copyTo(target);
  }
}

However, I need to make a thresholds for a categories. Let's say i have 2 categories in the stock: "Power Tools" and "Hand Tools". In case of Power tools i would like the script to run when the value reach 5 or less and in case of Hand Tools 10 or less. Category is set in column A and it have been set before so the trigger doesn't work when i write to conditions in the code as i changed only the amount value. Many thanks for advice!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!