I need to build an index table dynamically from the sheetnames of the tabs (BLUE color).
The expected result is shown in YELLOW color.
The rows must be unique along with the sheetnames being displayed in the first column.
I tried in this sheet
Non Formula formula is here: =INDIRECT(CONCATENATE("{",TEXTJOIN(";",true,ARRAYFORMULA("'" &A6:A32 &"'!" & "A2:B")),"}"))
A formula solution is not possible for multiple sheets + indirect.
One option to solve this is to build the dynamic part of your formula with another formula.
Here's what I mean:
The dynamic part of the formula is constructed with this formula:
={"Dynamic part of the formula" ; JOIN(";"&char(10),FILTER("QUERY({"&A2:A&"!A2:C},""select '"&A2:A&"', Col1, Col2, Col3 where Col1 != '' label '"&A2:A&"' ''"")",A2:A<>"")) }
It assumes column A is released for sheet names only. It produces the result like this:
Dynamic part of the formula
QUERY({Sheet1!A2:C},"select 'Sheet1', Col1, Col2, Col3 where Col1 != '' label 'Sheet1' ''");
QUERY({Sheet2!A2:C},"select 'Sheet2', Col1, Col2, Col3 where Col1 != '' label 'Sheet2' ''");
QUERY({Sheet3!A2:C},"select 'Sheet3', Col1, Col2, Col3 where Col1 != '' label 'Sheet3' ''");
QUERY({Sheet4!A2:C},"select 'Sheet4', Col1, Col2, Col3 where Col1 != '' label 'Sheet4' ''")
The final formula uses this part. You'll need to do the next step manually or write a short script for this. Manual process:
Go to a cell with the generated part of the formula. Hit [F2] to enter it, select and copy all. Go to the final formula and replace this part:
={"Sheetname","sub_category","category_filter"; QUERY(UNIQUE({
QUERY({Sheet1!A2:C},"select 'Sheet1', Col1, Col2, Col3 where Col1 != '' label 'Sheet1' ''");
QUERY({Sheet2!A2:C},"select 'Sheet2', Col1, Col2, Col3 where Col1 != '' label 'Sheet2' ''");
QUERY({Sheet3!A2:C},"select 'Sheet3', Col1, Col2, Col3 where Col1 != '' label 'Sheet3' ''");
QUERY({Sheet4!A2:C},"select 'Sheet4', Col1, Col2, Col3 where Col1 != '' label 'Sheet4' ''")
}),"select Col1, Col2, Col3") }
I am sure there must be a more elegant formula to achieve the desired output.
However, this works just fine:
=query(UNIQUE({"Sheetname","sub_category","category_filter","duplicate";{ARRAYFORMULA("Sheet1"&T(SEQUENCE(COUNTA(Sheet1!A2:A))));ARRAYFORMULA("Sheet2"&T(SEQUENCE(COUNTA(Sheet2!A2:A))));
ARRAYFORMULA("Sheet3"&T(SEQUENCE(COUNTA(Sheet3!A2:A))))},{INDIRECT("Sheet1!A2:C"&COUNTA(Sheet1!A1:A));
INDIRECT("Sheet2!A2:C"&COUNTA(Sheet2!A1:A));INDIRECT("Sheet3!A2:C"&COUNTA(Sheet3!A1:A))}}),"Select Col1,Col2,Col3")
Related
Consider this table:
Col1
Col2
Col3
Col4
1
s
2
3
s
What's the filter formula (or any other formula for that matter) so that it will only retain the rows if any of the cells from col2 to col4 is not empty?
So the output should be:
Col1
Col2
Col3
Col4
1
s
3
s
Google sheet sample here https://docs.google.com/spreadsheets/d/1ugIbzetQGb0IV32iE0aG49wEK1xSuFLHqDUnzoLnGnM/edit?usp=sharing
Thanks! Much appreciated.
One option for Google Sheets:
=FILTER(A1:D4,BYROW(B1:D4,LAMBDA(x,COUNTIF(x,"?*"))))
For ms365:
=FILTER(IF(A1:D4="","",A1:D4),BYROW(B1:D4,LAMBDA(x,SUM(--(x<>"")))))
Looking for some help...
Is there a way to get the column header name based off the row header name and a value within the body, please note that there are duplicates.
For example from the below table based on RowH2 and table body X, the col1 and col3 column header names should be provided.
Col1 Col2 Col3
RowH1 X
RowH2 X X
RowH3 X
Thanks
Am having some issue using the VLOOKUP function in excel. Am a little new to excel and puzzled as to how to solve this problem. I have two excel sheets.
Sheet 1 looks like:
Col1 Col2 Col3
HIC GSN ND11
H1C 00214 0212107
C4I 07287 0214380
L1A 07731 0214501
Sheet 2 looks like:
Col1 Col2 Col3 Col4 Col5 Col6 Col7
Condition HIC1 HIC1 HIC1 GSN GSN GSN
AMA B60 B61 B62 02934 02935
ALD H1A H1C 04821 03473
HEC W0A W0B
The VLOOKUP formula that am using is:
=VLOOKUP(B2,'Conditions.xlsx]Conditions'!$B$2:$BH$24,60,0)
Here B2 refers to Sheet 1, Column 1. Index Number 60 is a repeated Column 1 in Sheet 2. Is there a better way to lookup the COl1 and Col2 in Sheet one to extract the Conditions Columnin Sheet 2?
Any help would be great.
Read this: How to use INDEX MATCH instead of VLOOKUP
But what happens if you want to look from right to left? VLOOKUP simply can't do that. INDEX/MATCH can.
I'm trying to query an excel worksheet using ADODB. The problem is there are many columns with a similar name and I'm unable to select the correct column in my query. Is there a was to select the column by using its range? Something like
select [A:A],[AB:AB] from [Sheet1$]
The source worksheet kind of looks like this
A B C D E F G H I
1 08/19/2013 08/18/2013 08/17/2013
2 Col1 Col2 col3 col4 col5 col3 col4 col5 col3
3
When I try to import all the data I get all the data minus the column names, only col1 and col2 are fetched. Its the same when I do from [Sheet1$] and from [Sheet1$A2:K100]
If there are multiple columns with the same or similar names, Excel/ODBC will probably do some funky name-mangling to make sure they are different in the recordset. What I would do is get all the columns with "SELECT *" then examine the fields names in the result set - then you can go back and retrieve by name just the columns you want.
I am trying to lookup data, using optional criteria.
For example the input data may be :
Col1 Col2
Pig Mouse
and the lookup table :
Col 1 Col2 Col3
Pig 1
Pig Mouse 2
So this example would return 2. If just Pig was in the input data, it would return 1
=SUMPRODUCT(($A$7:$A$8=A2)*($B$7:$B$8=B2)*($C$7:$C$8))
This will return every value from columnC where ColumnA = A2 and ColumnB = B2, even if the values are blank.