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

171
Views
Comparar cadenas, coeficientes

Actualmente tengo una hoja con múltiples parámetros vinculados a múltiples coeficientes. Tengo un parámetro en el lado izquierdo y un parámetro en el lado derecho.

Cómo hacer para que en la MISMA LÍNEA aparezcan los coeficientes del mismo parámetro (los parámetros del lado derecho serán entonces los mismos que los del lado izquierdo en la misma línea). Si un parámetro de la izquierda no aparece a la derecha, deje un espacio en blanco a la derecha. También tengo, para ciertos parámetros, varios coeficientes.

ingrese la descripción de la imagen aquí

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

0

Descripción

El siguiente ejemplo utiliza los coeficientes de la columna A y filtra todos los coeficientes coincidentes de la columna E:G. También los organiza en la misma fila.

Guion

 function test() { try { let sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Test"); let sheetLastRow = sheet.getLastRow(); // Get range of A:C let coef1 = sheet.getRange(1,1,sheetLastRow,3); let lastRow = coef1.getNextDataCell(SpreadsheetApp.Direction.DOWN).getRow(); coef1 = coef1.getValues(); if( lastRow < sheetLastRow ) coef1 = coef1.slice(0,lastRow); // Put headers in result array let result = [coef1.shift()]; // Get range of E:G let coef2 = sheet.getRange(1,5,sheetLastRow,3); lastRow = coef2.getNextDataCell(SpreadsheetApp.Direction.DOWN).getRow(); coef2 = coef2.getValues(); if( lastRow < sheetLastRow ) coef2 = coef2.slice(0,lastRow); // Remove headers coef2.shift(); // Find unique coef numbers let coef = [...new Set( coef1.map( row => row[0] ) )]; // Filter all elements from E:G matching A:C coef.forEach( c => { let match = coef2.filter( row => row[0] === c ); if( match.length === 0 ) { result.push(['','','']); } else { result = result.concat(match); } }); // For now put in I:K sheet.getRange(1,9,result.length, result[0].length).setValues(result) } catch(err) { console.log(err); } }

Captura de pantalla

ingrese la descripción de la imagen aquí

Referencia

  • Rango.getNextDataCell()
  • Establecer
  • Array.slice()
  • Array.shift()
  • matriz.mapa()
  • Matriz.paraCada()
  • Matriz.filtro()
  • matriz.concat()
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!