Hi I'm just new in Google Apps Script. I want to modify this formula below to Google Apps Script
The lookup value is in wsPetitionStatusReport sheet. I tried code below but it always return null. Can you help me with this? Thank you so much
Excel Formula:
=arrayFORMULA(iferror(VLOOKUP(J3,{'WO SR 22/23'!P:P,'WO SR 22/23'!B:B},2,FALSE)))
The lookup value is in wsPetitionStatusReport sheet. I tried code below but it always return null. Can you help me with this? Thank you so much
VBA Code:
function vLookUpVALUE() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const wsWOSR = ss.getSheetByName("WO SR 22/23")
const wsPetitionStatusReport = ss.getSheetByName("Petition Status Report ")
const searchVALUES = wsPetitionStatusReport.getRange("J3:J").getValues()
const wsWOSRDATcolO = wsWOSR.getRange("B3:P" + wsWOSR.getLastRow()).getValues();
const matchDATAcolO = searchVALUES.map(searchROWcolO => {
const matchROWcolO = wsWOSRDATcolO.find (r => r[0] == searchROWcolO[0])
return matchROWcolO ? [matchROWcolO[0]] : [null]
})
console.log(matchDATAcolO)
}
Last edited: