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<>"")))))
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")
I have data in one column i.e., Purchases as
Purchases
2 Pens
3 Books
4 Pens
1 Gifts
2 Books
I want to split it as
Col1 Col2 Col3
2Pens 3Books 1Gift
4Pens 2Books
In Excel O365, you could use in C1:
=FILTER($A1:$A5,ISNUMBER(SEARCH("* "&INDEX(UNIQUE(MID($A1:$A5,FIND(" ",$A1:$A5)+1,LEN($A1:$A5))),COLUMN(A1)),$A1:$A5)))
Drag the formula right.
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.
Hi all I want to merge to columns in excel 2003.
For example:
Col1 Col2
------------
1 5
3 4
4 6
7 6
The merged column should look like this:
Col3
----
1
3
4
4
5
6
6
7
Thanks!!
Assuming, that your Col1, Col2 and Col3 are Columns A, B and C, you can use makro:
Range("A1:" & Range("A65536").End(xlUp).Address).Select
Selection.Copy
Range("C1").Select
ActiveSheet.Paste
Range("B1:" & Range("B65536").End(xlUp).Address).Offset(1, 0).Select
Selection.Copy
Range("C65536").End(xlUp).Select
ActiveSheet.Paste
Source: link
Although you could easily use Excel's built-in functions to copy and paste the values from each column into the third column, you don't state if it's a requirement that the results in Col3 need to be sorted, or whether duplicate values should be removed or not. If so, you might have to write a user-defined function (equivalent to an Excel macro) in Excel VBA to do this.
Your solution might look like this (pseudo-code):
Iterate through all rows in Col1 and store values in an array
Iterate through all rows in Col2 and store values in a second array
Create a new array and combine the values from the other two arrays
Output the values from the combined array into Col3
Your function/macro will probably need to accept three input parameters which would be the ranges of the two source columns and the output column.