• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

128
Views
Compare 2 columnas de hojas separadas y devuelva el valor de la celda adyacente

Estoy tratando de comparar dos columnas y encontrar una coincidencia y luego devolver el valor de la celda adyacente. Busqué respuestas en Google pero no pude encontrar una respuesta que pudiera usar. Casi todo lo que vi no usó script sino una fórmula de hojas. las pocas funciones que vi tampoco encajaban.

 function findDuplicate() { var sheet1 = SpreadsheetApp.getSheetByName('Working'); var s1 = sheet1.getRange('A:A').getValues(); var sheet2 = SpreadsheetApp.getSheetByName('Match'); var s2 = sheet1.getRange('A:A').getValues(); var mv = s1 === s2; var matchedValue = mv.getvalue(); return matchedValue.offset(0, 1); }

No estoy seguro de cómo hacer esto por completo. Entiendo que mi código está incompleto, pero comencé por el camino lo mejor que sé. Y para facilitar el tiempo, sí, necesito que esto se haga en Apps Script, ya que será parte de otro montón de código.

enlace de hoja de ejemplo a continuación https://docs.google.com/spreadsheets/d/1OKFoS17le-Y5SAOecoLE4EJxiKqKVjRLRHtMzwHNwxM/edit?usp=sharing

almost 3 years ago · Santiago Gelvez
1 answers
Answer question

0

Buscar coincidencia y devolver la siguiente columna

 function findDuplicate() { const ss = SpreadsheetApp.getActive(); const sh1 = ss.getSheetByName('Working'); const vs1 = sh1.getRange('H1:H' + sh1.getLastRow()).getValues(); const sh2 = ss.getSheetByName('Match'); const vs2 = sh1.getRange('A1:B' + sh2.getLastRow()).getValues(); let o = []; vs1.forEach((r,i) => { if(r[0] == vs2[i][0]) { o.push(vs2[i][1]); } }); Logger.log(JSON.stringify(o)); return o; }
almost 3 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error