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

246
Views
Google Sheets, if else, statement inoperative

I've been trying to compare balance and totalPrice variables, so that trades which are over balance of the account, aren't recorded, but I'm seeing errors, with no messages, it's just stuck on else statement, when I deleted else statement, results are null, not even 'Failed' is printed.

function GenieBook() {

  var ss = SpreadsheetApp.getActiveSpreadsheet();

  var trade = ss.getSheetByName("Genie");
  var tradeBook = ss.getSheetByName("Trade Data");
  var tradeDataImport = ["B13", "E13", "G13", "I13"];
  var tradeDataExport = tradeDataImport.map(f => trade.getRange(f).getValue());

  var balance =   SpreadsheetApp.getActiveSheet().getRange("B10");
  var totalPrice =   SpreadsheetApp.getActiveSheet().getRange("I13");

if( balance > totalPrice ){

  SpreadsheetApp.getActiveSheet().getRange("L13").setValue("Success!");
    tradeBook.appendRow(tradeDataExport);


}

else{
  SpreadsheetApp.getActiveSheet().getRange("L13").setValue("Failed!");
}
  //console.log(tradeDataExport)
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You have omitted getValue()

  var balance =   SpreadsheetApp.getActiveSheet().getRange("B10").getValue();
  var totalPrice =   SpreadsheetApp.getActiveSheet().getRange("I13").getValue();
about 4 years ago · Juan Pablo Isaza Report
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!