Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

89
Vistas
Moving Row to another sheet and clear content/ ArrayFormula

Short story: How do I modify the script below to clear contents in multiple cells in the row? For example Rows 7,13,24,25,34

Long story (in case there is a better solution):

I have been using this script to move rows between sheets based on a value without carrying over the formatting so the next sheet has its own and the conditional formatting isn't stacking up.

  function onEditComplete(e) {
 //e.source.toast('Entry');
 //Logger.log(JSON.stringify(e));
 const sh=e.range.getSheet();
 if(sh.getName()=="Sheet1a" && e.range.columnStart==5 && e.value=="Completed") {
  //e.source.toast('Conditional');
 var tsh=e.source.getSheetByName("Sheet2a");
 tsh.getRange(tsh.getLastRow()+1,1,1,sh.getLastColumn()).setValues(sh.getRange(e.range.rowStart,1,1,sh.getLastColumn()). 
getValues());
sh.deleteRow(e.range.rowStart);}
  }

The problem I am encountering now is I am using Formulas. I have 4 sheets. Sheet1a and Sheet1b have vlookup formulas between them. Sheet2a and Sheet2b will also have the same Vlookup formula between them.

=ArrayFormula(IFERROR(VLOOKUP(PARTS!$B1:$B,{PARTS!$B1:$B,PARTS!$AF1:$BD&","&PARTS!$AJ1:$AJ&","&PARTS!$AN1:$AN&","&PARTS!$AR1:$AR&","&PARTS!$AV1:$AV&","&PARTS!$AR1:$AR&","&PARTS!$AZ1:$AZ},2,0)))

Since it's an ArrayFormula, as long as Sheet2a and Sheet2b are set it should only be a matter of clearing the content in the specific cells before it moves over since it transfers as text value and breaks the formula in Sheet2a and Sheet2b.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Adding the ability to clear some cells in rows 7,13,24,25,34

function onEdit(e) {
  e.source.toast('Entry');
  Logger.log(JSON.stringify(e));
  const sh = e.range.getSheet();
  if (sh.getName() == "Sheet0" && e.range.columnStart == 5 && e.value == "Completed") {
    e.source.toast('Conditional');
    let cols = [7, 13, 24, 25, 34];
    let row = sh.getRange(e.range.rowStart, 1, 1, sh.getLastColumn()).getValues().flat().map((e, i) => {
      if (~cols.indexOf(i + 1)) {
        return null;
      } else {
        return e;
      }
    })
    var tsh = e.source.getSheetByName("Sheet1");
    tsh.getRange(tsh.getLastRow() + 1, 1, 1, sh.getLastColumn()).setValues([row]);
    sh.deleteRow(e.range.rowStart);
  }
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda