I exported products to google sheet from woocommerce site with wp all export and it brings me too much columns and the more columns the harder it is handle and slower to import so i have tried query thet filters out columns that have in the title the word "taxonomy" and it seems that it can work for more complicated things as well
=QUERY(FILTER(test!K2:DF9,REGEXMATCH(test!K2:DF2,"Taxonomy")=False),"SELECT *")
this is products attribute columns:
"Name _1 Value _1 Variations _1 Visible _1 Taxonomy _1"
for each attribute the number is incremented so the next attribute column looks like this:
"Name _2 Value _2 Variations _2 Visible _2 Taxonomy _2"
each possible value have these 5 columns to be able to map it with wp all import
and i have over 50 possible values * 5 = 250 columns (too much unneeded columns)
so in the case above if Value _1 column is empty
i need to filter out these columns from the QUERY
"Name _1 Value _1 Variations _1 Visible _1 Taxonomy _1"
if Value _2 column is empty
i need to filter out these columns from the QUERY
"Name _2 Value _2 Variations _2 Visible _2 Taxonomy _2"
how can i query only the coulmns thet the "Value _(any number)" column is nat empty?
Found simple workaround, first use this to extract the number of the not empty column to the row above.
=if(JOIN("",AX3:AX)=""=false,REGEXEXTRACT(AX2,"\d+"),"")
then filter empty cells and join with "|" delimiter so it's ready for regex
=JOIN("|",FILTER(C1:1,C1:1<>""))
and now I can use REGEX MATCH with the joined numbers that look like this 9|17|20 etc. That is placed in 'test'!A1
=FILTER('test'!I2:IS250,REGEXMATCH('test'!I2:IS2,'test'!A1))
Related
I have a spreadsheet with multiple columns. Each column represents a recipe. Each column has a week number (e.g. 2, 3, 4)... Below the week number, we have a variable number of ingredients. I want to be able to merge all the ingredients from a given week into a single column.
Sample Data
I know how to statically merge ranges e.g. {B4:B20;C4:C20} and I can also think of using an if statement to check the week value e.g. =if(B1=2,{B4:B20;C4:C20}) but that's not close to what I want. I need to check the range B1:Z1 for the value of the week and if that value is X (let's say 2) then take the ingredients in B2:B and tack them on to C2:C and so on...
If I'm understanding you correctly, this should do it:
=QUERY(FLATTEN(FILTER(B3:Z,B1:Z1=2)),"WHERE Col1 Is Not Null")
FILTER keeps (i.e., "filters in") only the data in B3:Z where the header is 2.
FLATTEN forms one column (blank cells and all) from the FILTER results.
QUERY keeps only non-blank (i.e., Is Not Null) entries from that single-column list.
I have three columns of information. For example: color, model, year.
Can I use the "unique" instruction to generate in three new columns each unique combination for color, model, year, each in one column?
ex.
color model year
red sedan 2016
red sedan 2020
black truck 2018
Thanks!
Suppose your three headers are in A1, B1 and C1 with your data running A2:C. And suppose you want the unique combinations in E:G. First, be sure that the entire range E:G is empty. Then place the following formula in E1:
=ArrayFormula({A1:C1;SPLIT(FLATTEN(UNIQUE(FILTER(A2:A,A2:A<>""))&"|"&TRANSPOSE(FLATTEN(UNIQUE(FILTER(B2:B,B2:B<>""))&"|"&TRANSPOSE(UNIQUE(FILTER(C2:C,C2:C<>"")))))),"|")})
The formula first reproduces the headers from A1:C1.
The combinations are formed by first concatenating each UNIQUE model (from a list that is FILTERed to remove blanks) with each UNIQUE year (from a list that is also FILTERed to remove blanks), with a pipe symbol between each as a separator that SPLIT will later use.
That grid of combinations is FLATTENed into a single column and then concatenated once more with a UNIQUE and FILTERed list of the colors leading off, and again with a pipe symbol as a separator. Once more, the entire grid of results is FLATTENed into a single column.
Finally, SPLIT acts on the pipe symbols to separate the three pieces into their own columns under the headers.
try:
=INDEX({A1:C1; UNIQUE(QUERY(SPLIT(FLATTEN(FLATTEN(A2:A&"×"&
TRANSPOSE(B2:B))&"×"&TRANSPOSE(C2:C)), "×"),
"where Col3 is not null"))})
the task is simple: take column A and combine it with transposed column B. flatten the output in one single column and combine it with transposed column C and again flatten it into one single column. then split it and query out all combinations that have less than 3 columns. next, run it through unique to remove duplicates.
Hi everyone,
I want to mix the food and drink together to form different combination. Since there are 4 type of food and 4 type of drink, which means there will be 16 types of different combination. I managed to automate the food in column F by repeating 4 times (since there are 4 type of drink) for each type of food, however, I have no idea how to automate the drink in column G to complete the 16 different combination.
When I added in new food and drink in Column B & C, ideally the new possible combination will appear in Column F & G as well.
Column I & J are the expected output that I desired. Hope to get some advice from expert. Any help will be greatly appreciated!
This is my sheet:
https://docs.google.com/spreadsheets/d/1YW5_dfCSQ4BTnA09iss3wa9dWHGDlGjqoDRJ9buMDO0/edit#gid=792268474
I have added a new sheet ("Erik Help") with the following formula in D1:
=ArrayFormula({"Food","Drink"; SPLIT(FLATTEN(FILTER(A2:A,A2:A<>"")&"|"&TRANSPOSE(FILTER(B2:B,B2:B<>""))),"|")})
This one formula creates the headers and all results in Columns D and E.
The header text can be changed within the formula as you like.
The rest just concatenates every non-null food value with a pipe symbol ("|") and a TRANSPOSEd list of every non-null drink value, forming a virtual 2D grid. That is FLATTENed into one column and then SPLIT at the pipe symbol back into two columns.
The formula will "keep up with" new food and/or drink items added (or any removed from either list). The lists need not have the same number of items either.
or:
=INDEX({FLATTEN(SPLIT(REPT(CONCATENATE(B6:B&"♦"), COUNTA(C6:C)), "♦")),
FLATTEN(SPLIT(CONCATENATE(REPT(C6:C&"♦", COUNTA(B6:B))), "♦"))})
Hello I Have a sheet with a list of names, medications, statuses and correlating dates on a spreadsheet. On a separate spreadsheet I would like to be able to type in a date and status (ex. "Pending", "active") and have the correlating patient names come up.
If i Type in 5/6/21 and then "active" I would like the formula to search the master-sheet and return names of patients whos status is "Active" after the Date 5/6/21.
I can't open your second sheet, but based on the first one, I've added a date input in cell F2.
Sheets QUERY is a powerful function that is similar to SQL. It can be used to display data from a dataset based on certain parameters (like your date search, and status = active).
In the example, the following QUERY formula goes in cell H1, but you can move it to a different tab if needed, obviously referencing 'DATA'!A:E etc.
=if(isblank(F2),,iferror(query(A:E,"where D > date '"&text(F2,"yyyy-mm-dd")&"' and lower(E) contains 'active' order by D,A",1),"No result"))
functions
isblank - if cell F2 is blank (the date search), then nothing.
iferror - if the query doesn't return any values, just output the wording 'No result'.
query function - as per the parameters below.
The range of your data is cells A:E.
The where clause basically says that the value in col D needs to be greater than the date within the single quotes '', which contains "&text(F2,"yyyy-mm-dd")&", which is the value of cell F2, formatted as text in the structure yyy-mmm-dd.
Placing "&<Sheets function>&" within the single quotes '' allows you to put another Sheets function in the query syntax, in this example the text function that formats the input of cell F2 as a date yyyy-mm-dd.
The where clause also includes an and where the lowercase of column E, lower(E) contains the word 'active'.
The results are ordered by column D then column A.
The ,1 at the end of the query tells it to treat the first row of data as headings. If it was data and not a heading, then it would be ,0.
Let me know if you need it implementing on your actual sheet.
I have a column in google spreadsheet name domains which contains the array of values like ['non work', 'work', 'work', 'non work'], is there a way to find the count within that column which equals to work
Below is the screenshot of what I want to achieve.
In Work Domain Count column values should be respectively 3, 2 and 0
=SUMPRODUCT(REGEXMATCH(TRIM(SPLIT(REGEXREPLACE(A1,"[\[\]\']",""),",")),"^work$"))
REPLACE the non word characters like ',[ with null
SPLIT by the comma ,
Check whether each of the words MATCHes only work
SUM up the TRUEs of such MATCH.