I need to alter my Matching function, that matches two columns on separate sheets and returns a the matches to a third sheet so that it returns the row of the match
I have been trying, my head is spinning, no success
Thanks
function RunMatch() {
// 0 is the LookIn sht column # to match on
// 1 is the LookWith sht column # to match on
MatchCols("LookInSheet","LookWithSheet","PostbackSheet",0,1)
}
function MatchCols(sShtName,tShtName,pbShtName,matchIn, matchWith){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var LookInSht = ss.getSheetByName(sShtName);
var LookWithSht = ss.getSheetByName(tShtName);
var PBSheet = ss.getSheetByName(pbShtName);
var LookIn = LookInSht.getDataRange().getValues();
var LookWith = LookWithSht.getDataRange().getValues();
var list = [];
for (i in LookIn){
var curName = LookIn[i][matchColIn];
var exists = true;
for (j in LookWith){
var curCheck = LookWith[j][matchColWith];
if (curCheck == curName){
exists = false;
break;
};
}; // end for j
list.push([exists ? "" : curName]);
} // end for i
PBSheet.getRange(1, PBSheet.getLastColumn() +1, list.length, 1).setValues(list);
}