I have some problems, I am trying to resolve this now since a while but I am always ad a dead end.
#3
To help you adding new tabs in your formula, you can refresh it by a little script, example for PKG-ID, BOL:
function myFunction() {
var id = '1EO2dTznbgaWu1CCWl3OyAw54Zd3jtkhDuOgnal671KI'
var ss = SpreadsheetApp.openById(id)
var rng = []
ss.getSheets().forEach(sh => rng.push(`IMPORTRANGE("${id}", "${sh.getName()}!A:J")`))
var formula = `=QUERY({${rng.join(';')}}, "WHERE Col2 = '"&TEXTJOIN("' OR Col2 = '", TRUE, A:A)&"' OR Col3 like '"&TEXTJOIN("' OR Col3 like '", TRUE, A:A)&"'", 0)`
SpreadsheetApp.getActiveSpreadsheet().getSheetByName('PKG-ID, BOL').getRange('B3').setFormula(formula)
}
edit
by script
function artikleFinder() {
var id = '1EO2dTznbgaWu1CCWl3OyAw54Zd3jtkhDuOgnal671KI'
var source = SpreadsheetApp.openById(id)
var sh = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('TEST (script)')
sh.getRange(3,2,sh.getLastRow(),sh.getLastColumn()).clearContent()
var list = sh.getRange('A3:A').getValues().filter(r => r[0] != '').join().split(',')
var data = []
list.forEach(function (crit) {
source.getSheets().forEach(function (sh) {
var blankRow = Array.from({ length: 1 }, () => Array.from({ length: 10 }, () => ''))
var prov = sh.getRange(1,1,sh.getLastRow(),10).getValues().filter(
r => (r[1] == crit || r[2] == crit || r[4] == crit || r[5] == crit || r[6] == crit)
)
if (prov.length){
data.push(prov)
data.push(blankRow)
}
})
})
result = data.flat()
sh.getRange(3,2,result.length,result[0].length).setValues(result)
}
The result will be in the same order as the list in column A. However, if a row matches different criteria, that row will be duplicated