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

147
Views
Horizontal array not comparing in if statement

I'm having an issue testing a range to see if the contents are blank. It seams like whatever I place in the if statement (entryTons == blankTest) I cannot get a true result. Can you not compare arrays? I have a solid work around but I was curious why this doesn't work. When comparing the arrays in the debug window they look identical Screenshot

function onEdit() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var dataSheet = ss.getSheetByName("Enter Data");
  var entryRange = dataSheet.getRange(4,1,1,11);
  var entryData = entryRange.getValues();
  var entryTons = dataSheet.getRange(4,2,1,10).getValues();

  var defaultDate = "Today's Entry";
  var blankEntry = [[defaultDate,"","","","","","","","","",""]];
  var blankTest = [["","","","","","","","","",""]];

  if (entryData[0][0] == defaultDate ) return;
  else 
  {
    if (entryTons == blankTest) 
    {
      var ui = SpreadsheetApp.getUi();
      ui.alert("Enter Date after ALL tonnages have been entered.");
      entryRange.setValues(blankEntry);
      return;
    }
    else
    {  
      dataSheet.appendRow(entryData[0]);
      entryRange.setValues(blankEntry);
    }
  }
}
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!