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

160
Views
Compare 2 columns from separate sheets and return value from adjacent cell

I am trying to compare two columns and find a match then return value from adjacent cell. I searched for answers on google but I could not find an answer that I could use. Most everything I saw did not use script but a sheets formula. the few I functions I did see didn't fit either.

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);

}

I am unsure how to fully do this. I understand my code is incomplete but I started down the path the best I know how. And for ease of time, yes I need this to be done in Apps Script as it will be part of another bunch of code.

example sheet link below https://docs.google.com/spreadsheets/d/1OKFoS17le-Y5SAOecoLE4EJxiKqKVjRLRHtMzwHNwxM/edit?usp=sharing

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Find match and return next column

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;
}
about 4 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 Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!