In Google Sheets, I'm trying to indicate whether each cell in a specific column (the "Target Column") contains any of the words listed in a group of cells (the "Word Warehouse"), organized into different "Categories". If the word appears in the Word Warehouse, I would like the cell to spit out the category that it's listed under, e..
See attached sheet here: https://docs.google.com/spreadsheets/d/10jiicpOpplaURrF0UtTi9HM2TFP04-tinynpnFef2mE/edit#gid=0
Thanks in advance!
Try:
=INDEX($2:$2,1,MAX((ISNUMBER(SEARCH(IF(LEN($D$3:$F$7),$D$3:$F$7),A3))*COLUMN($D$3:$F$7))))
Alternatively, you can also try
=ArrayFormula(iferror(VLOOKUP(regexextract(proper(A2:A), textjoin("|", 1, D2:F)), split(flatten(D2:F&"_"&D1:F1),"_"), 2, 0)))
This formula allows for an array output, so dragging down is not necessary.
Related
I want to join the text but the number of rows differ for each record. If I use the static range data is missing for few records, in below example 22Inch is missing,
Used the below formula. How to dynamically change the range.
=TEXTJOIN(",",TRUE,A3:A8,"")
try:
=TEXTJOIN(",", 1, A3:INDEX(A:A, MIN(IFERROR(1/(1/(ROW(A3:A)*(A3:A="")))))))
Can you test this one out:
=LAMBDA(z,BYROW(z,LAMBDA(a,REGEXREPLACE(TEXTJOIN(",",1,IFNA(FILTER(A2:A,XLOOKUP(ROW(B2:B),z,z,,-1)=a))),"^(.*?)\,",""))))({ROW();BYROW(A3:A,LAMBDA(z,IF((z<>"")*(OFFSET(z,-1,0)=""),ROW(z),)))})
Here's another formula you can try:
=QUERY(INDEX(LAMBDA(ζ,SORT(REGEXREPLACE(ζ,"^,",),COUNTIFS(A1:A,"",ROW(A1:A),"<="&ROW(A1:A)),1,LEN(ζ),))({"";IF({A3:A;""}<>"",,SCAN(,A2:A,LAMBDA(a,c,IF(c="",,a&","&c))))})),"limit "&ROWS(A2:A))
I'll try to explain this the best i can.
I've got a database that hardly ever changes on 1 tab and i've got a dynamic table on other tab which is generated with data from the web.
I am trying to set up a formula that changes the outcome based on the colors i selected.
i can't link the original sheet but i tried to put together a small test sheet to make it more clear
https://docs.google.com/spreadsheets/d/114DxB1vqdH9MHuE5jr-iR1WfUdjMk4sY0dtvkCN80Y8/edit?usp=sharing
The linked sheet discribes what i want to get.
i tried allot of formulas and the closest i got gave me only the first result and it was combination of filter and vlookup but i accidently deleted that and can't really reproduce it...
added formula to your sheet. Please test it out:
=ARRAYFORMULA(QUERY(LAMBDA(ax,{PROPER(INDEX(ax,,1)),IFERROR(SPLIT(VLOOKUP(INDEX(ax,,2),A:A&"🐠"&B:B,1,),"🐠"))})(QUERY(SPLIT(FLATTEN(D3:D&"|"&E3:E&"🐠"&TRANSPOSE(G3:G10)),"|",0,0),"Select * Where Col1!=''")),"Select * Where Col2!=''"))
-
Another option it stacks up different queries with REDUCE, also gives you a message if product is not found in that colour:
=REDUCE({A2:B2,"colour"},SEQUENCE(COUNTA(E3:E)),LAMBDA(a,v,{a; IFERROR (QUERY(A3:B100,"SELECT '"&INDEX(D3:D,v)&"',A,B where A = '"&INDEX(E3:E,v)&"' and B matches '"&JOIN("|",FILTER(G3:G,G3:G<>""))&"' label '"&INDEX(D3:D,v)&"' ''",),{INDEX(D3:D,v),INDEX(E3:E,v),"not found in any colour"})}))
try:
=INDEX(QUERY({VLOOKUP(A3:A10, {E3:E10, D3:D10}, 2, ), A3:B10},
"where Col3 matches '"&TEXTJOIN("|", 1, G3:G10)&"'", ))
In Sheet1 A1:A I have a list of words. In Sheet2 A1:A I have a list with search terms. I now want to match each cell in Sheet1 to see if it contains words from the list of search terms. If yes, then the the words that matches inside the cell should be removed.
I have tried the following formulas, unfortunately without success.
=ArrayFormula(regexreplace(A1:A;Sheet2!A:A;""))
=substitute(A1;Sheet2!A$1:A;"")
The formula mentioned in the post Using multiple SUBSTITUTE functions dynamically does not working for me because I need an exact match regexreplace.
=ArrayFormula(IF(LEN(A2:A), REGEXREPLACE(A2:A, TEXTJOIN("|", 1, B2:B),),))
This will also remove the words from words that are part of words. for example, not only the word apple will be deleted, but also the word apple from appletree, which is not supposed to be.
Maybe try
=ArrayFormula(IF(LEN(A2:A), REGEXREPLACE(A2:A, "\b("&TEXTJOIN("|", 1, B2:B)&")\b",),))
and see if that helps?
I have a column of data that contains names, and the name always appears above a cell which contains parentheses. I'm able to run a query that shows those cells
=query(A:A,"Select * where A contains '('",)
but it's the cells directly preceding them that I need. Any help would be appreciated.
Try the following:
=index(hlookup("z",{"z";A:A},filter(row(A:A),regexmatch(A:A,"\(")),0))
You can replace the two occurrences of z with whatever you want.
The formula is self-explanatory if you are familiar with HLOOKUP and arrays.
try:
=QUERY(A:A; "skipping 2")
or:
=QUERY(A:A; "where not A contains '('")
I need to extract each individual person from a list that doesn't contain a certain activity (Project). Sounds easy but I can't quite get to the end of it.
Please check the example here on Sheet 2:
https://docs.google.com/spreadsheets/d/1qjbjXFCYj1qXrVVGNnhOj11asxT_o1xHWXerRqAl1UQ/edit#gid=2105763617
Here's the logic.
First I attempted to see if the individual only occurs once and if the Activity is not "Project"
=IF(A2<>"",IF(and(COUNTIF(A:A,A2)=1,B2<>"Project"),0,1),"")
Then I just extract the name that satisfies this criteria:
=query(ARRAYFORMULA(iF(I2:I=0,A2:A,"")), "where Col1 <>'' ")
This works, except there might be multiple assignments for the same person that does not contain the activity "Project" which my formula doesn't account for nor is it a simple dynamic arrayformula.
=UNIQUE(FILTER(A2:A, B2:B<>"Project"))
=UNIQUE(QUERY(A2:B, "select A where B <>'Project'", 0))
=UNIQUE(FILTER(A2:A, B2:B<>"Project",
NOT(REGEXMATCH(A2:A, "^"&TEXTJOIN("$|^", 1, FILTER(A:A, B:B="Project"))&"$"))))
While #player0's answer solves the question, it took a big performance hit on a sheet with >1000 rows.
Instead, I extracted all names that contained "Project" and then all names that did not contain "Project", then subtracted all the names from the first array to eliminate names that were in both.
=UNIQUE(FILTER(UNIQUE(FILTER(A2:A, B2:B<>"Project")), ISNA(MATCH(UNIQUE(FILTER(A2:A, B2:B<>"Project")), UNIQUE(FILTER(A2:A, B2:B="Project")),0))))
You may try this also:
{=IFERROR(INDEX($A$2:A$25,MATCH(0,IF($C$1<>$B$2:$B$25,COUNTIF($F$1:$F1,$A$2:$A$25), ""), 0)),"")}
N.B.
Cell C1 has criteria Project, using cell reference makes the formula
dynamic rather than hard coded.
Enter this formula in cell F2, finish with Ctrl+Shift+Enter,
and fill down.