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

184
Views
Obtenga el script de Google Sheets para repetir el proceso hasta que se alcance un cierto valor

Soy nuevo en los scripts y no estoy seguro de cómo abordarlo.

En resumen, quiero que el script copie valores del rango L3:L118 a N3:N118 hasta que el valor de P3 (suma de las diferencias entre los 2 rangos) sea 0,00. Logré crear una macro para la fase de copia, sin embargo, no estoy seguro de cómo hacer un bucle.

Aquí está el código

 function GetthepriceMK3() { var spreadsheet = SpreadsheetApp.getActive(); spreadsheet.getRange('N3:N118').activate(); spreadsheet.getRange('L3:L118').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false); }

¿Alguien podría ayudar con el bucle? No tengo idea de cómo empezar y los ifs

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Recoge la suma de las diferencias entre L y N hasta que la suma sea igual a v

 function GetthepriceMK3() { const ss = SpreadsheetApp.getActive(); const sh = ss.getActiveSheet(); const l = sh.getRange("L3:L118").getValues(); const n = sh.getRange("N3:N118").getValues(); let v = 0; let s = 0; for (var i = 0; i < l.length; i++) { s += l[i][0] - n[i][0]; if (s == v) { break;//stops the loop } } Logger.log(i);//row is i + 3 Logger.log(s); }
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!