I've a sheet where there are multiple tabs. I want to summarize first column and 11th column of all tabs.
I would like to merge the first column so there are only unique values. Then pull the data from first tab as 2nd column and second tab as 3rd column and so on. The sheet is here
What I've tried so far:
I have tried to use formula which is both manual and ever increasing. The tab name is "Desired".
For the first column I used query formula. I used only for two tabs since I've more tabs.
=UNIQUE(query({indirect(address(2,1,1,1,TEXT(B1,"ddmmmyyy"))&":A"),indirect(address(2,1,1,1,TEXT(C1,"ddmmmyyy"))&":A")},"Select Col1 where Col1 is not null"))
Then for each column I used vlookup
=VLOOKUP($A2,{indirect(address(2,1,1,1,TEXT(B$1,"ddmmmyyy"))&":A"),indirect(address(2,9,1,1,TEXT(B$1,"ddmmmyyy"))&":I")},2,0)
Update: I managed to solve the first part with the following code
function SUMMARIZE2() {
const ss = SpreadsheetApp.getActive();
const weekSheets = ss.getSheets().filter(sheet => sheet.getName().endsWith("2020"));
const summarySheet = ss.getSheetByName("Summary");
let weekData = weekSheets.map(weekSheet => {
return weekSheet.getRange(2, 1, weekSheet.getLastRow() - 1).getValues();
}).flat();
const getUnique_ = array2d => [...new Set(array2d.flat())];
uniqueValues = getUnique_(weekData).map(e => [e]);
var header = [["Company Name"]];
summarySheet.getRange("A1:A1").setValues(header);
summarySheet.getRange("A2:A"+(uniqueValues.length+1)).setValues(uniqueValues);
}
I appreciate the replies.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…