array formula and regexmatch won't follow through whole column - regex

I am having an issue with an Array Formula where my current formula is:
=ArrayFormula(if(REGEXMATCH(B2,to_text('Order Form 1'!A2:A))=true,"Approved",A2:A))
I am:
1. matching the responseTimestamp (text) to the whole column of Orders received.
2. if it matches then show "Approved",
3. else, it should populate the Order not matched into that cell.
It populates in the "Pending" column correctly if it (regex)matches "B2";
however, I have more data in that column and would like it to perform this formula over "B2:B".
When I do this it doesn't populate the correct answer.
Can anyone offer insights or a solution?
Here is a link to a copy of my workbook: https://docs.google.com/spreadsheets/d/1utgP82XMkb8cOhKX2_taGqfluq6jHLNkOqUVJ31WHBM/edit?usp=sharing
Thank you in advance!

See if this works
=ArrayFormula(if(REGEXMATCH(B2:B,TEXTJOIN("|", 1, 'Order Form 1'!A2:A)),"Approved",A2:A))
Or, if you just want to list the values from A that don't match in B, try
=filter(A2:A6, isna(match(A2:A6, B2:B6,0)))

=filter(A2:A6, isna(match(A2:A6, B2:B6,0)))
Thank you JPV, your answer worked best for how my columns are arranged.

Related

UNIQUE formula in Google Sheets for multiple ranges

I have a list of participants in column A. A full employee list in column B. I want to get the list of non-participants in column C. Basically 'B-A' but in list form.
'January' is the participants list:
try:
=FILTER(A:A; NOT(COUNTIF(B:B; A:A)))
It is always an added challenge to write formulas when we don't have access to actual date. But based on what I can see, try this formula in the top cell of any empty column:
=ArrayFormula({"My Header"; FILTER(R2:R,ISERROR(VLOOKUP(TRIM(R2:R),TRIM(T2:T),1,FALSE)))})
You can change "My Header" to something meaningful.
The next part means "FILTER in anything in the range R2:R that cannot be found [i.e., ISERROR(VLOOKUP(...))] in T2:T."
TRIM is used just to account for any accidental/stray spaces that may occur in either list, since that would result in no match if one or the other had extra space.
If this does not do what you expect, please share a link to a sample spreadsheet.

How to do multiple searches in an array formula?

I'm working on trying to get some formula working that'll vastly improve my QOL at work. I want the formula to run 2 searches for keywords that will be present in my "Title" column and my "SKU" column then return results based on a key that I have located in a second tab.
The above screenshot is my key. If products contain any of the keywords in the title column then the corresponding category is automatically assigned.
In the example screenshot below I have the formula working to do 1 search. It's searching the "Title" column (B) against the Keywords column in the Key and if the word exists within the title it gives a result back based on the row that the result was on.
What I want to achieve is to do multiple searches within the same column. I want to be able to first do the search by "Title", if no results are returned then I want it to search via the "SKU" column against the Keywords and Categories in the Key (Columns C & D)
In the below screenshot I've tried wrapping it in an IF statement
IF(TITLESEARCH=""),(SKUSEARCH),(TITLESEARCH)
The results I'm getting back seem to be working for the first part of the IF statement. It's giving me back results that are correct for the first part of the IF statement, but the second part doesn't seem to be working correctly and I can't figure out why. Where it should be assigning the category "Accessories" it's just giving me "FALSE" instead.
Here's a link to the spreadsheet if anyone would like to take a look. I've been wracking my brain on this for a few days now and I feel like I've come a long way.
https://docs.google.com/spreadsheets/d/1548QMP5qeAIFrbraGD_lkJkQWzKF4Td6FR1KkcOHHJM/edit?usp=sharing
I'm quite new to Google Sheets and excel formula (especially on this level) so please be gentle. It feels like the mistake I'm making might be glaringly obvious.
https://exceljet.net/formula/categorize-text-with-keywords
This is what my formula is based on.
=IF(ARRAYFORMULA(INDEX('Array Key'!B:B,MATCH(TRUE,ISNUMBER(SEARCH('Array Key'!A:A,B234)),0)))="",(ARRAYFORMULA(INDEX('Array Key'!D:D,MATCH(TRUE,ISNUMBER(SEARCH('Array Key'!C:C,A234)),0),(ARRAYFORMULA(INDEX('Array Key'!B:B,MATCH(TRUE,ISNUMBER(SEARCH('Array Key'!A:A,B234)),0))))))))
delete all your formulas and simply use:
=ARRAYFORMULA(IF(LEN(B2:B), IF(IFERROR(VLOOKUP(REGEXEXTRACT(A2:A,
TEXTJOIN("|", 1, 'Array Key'!C3:C)),
'Array Key'!C3:D, 2, 0))="",
IFERROR(VLOOKUP(REGEXEXTRACT(B2:B,
TEXTJOIN("|", 1, 'Array Key'!A3:A)),
'Array Key'!A3:B, 2, 0)),
IFERROR(VLOOKUP(REGEXEXTRACT(A2:A,
TEXTJOIN("|", 1, 'Array Key'!C3:C)),
'Array Key'!C3:D, 2, 0))), ))

Return table with rows where certain column is blank

I thinks this is a very easy to answer question ,but I cant figure it out and im very beginner in DAX.
I have this sample data set:
I want to return a Table in powerbi with only the rows where job is blank. So it would look like this:
How to do this? :)
Because you mentioned DAX, you may use this expression to return a Table with only the rows, where job is blank:
FILTER('Table','Table'[job] = BLANK())
But I guess, it make sense for you only inside the measures, you want to calculate.
Click on the button in the title for job column and uncheck all values, except (Blank):

filter with multiple regexmatch?

my spreadsheet link with edit authorized - feel free to test any formula
https://docs.google.com/spreadsheets/d/1iY0p3_mdOfrjtBy9HPskzudf27m1mh_hApecsn0KW4A/edit#gid=1268421551
please look at the country that has statename such as P26-P38
I have 2 sheets - one is main sheet and another is named 'articles'
MAIN SHEET
ARTICLES
MAIN SHEET > on column P > I need to show the maximum date value located in column 'F' [articles!F:F]
from 'articles' sheet by finding any rows on column 'B' of 'articles' [articles!B:B]
that contains the number from column 'M' of 'Main sheet' [main!M:M]
so I use this formula
=IFERROR(MAX(filter(articles!F:F,regexmatch(","&articles!B:B,","&M58&","))))
and its working fine
but then I also need to find state name which is located in 'column E of articles'[articles!E:E]
like in the screenshot above I need to find 'Alberta' for Canada
as you can see the state name will come after '-' and follow by ':'
So it need to match both conditions and return the date
I don't know how can I define it in the formula 'regexmatch' and combine it together with the formula that I already have
I tried this but doesn't work
=IFERROR(MAX(filter(articles!F:F,regexmatch(","&articles!B:B,","&M58&","),articles!E:E,"-"&"
"&K58&":")
anyone please help, thanks
See if this works
=IFERROR(MAX(filter(articles!F:F,regexmatch(articles!B:B&articles!E:E, M59&K58&":"))))
If not, please share a copy of your spreadsheet with editing rights.
EDIT: after seeing the data, try (e.g. in P26)
=IFERROR(MAX(filter(articles!F:F,regexmatch(","&articles!B:B,","&M26&","), regexmatch(articles!E:E,K26))))
Drag up or down as far as needed.

Fuzzy match on google sheets

I'm trying to fuzzy match two columns in google sheets, i've tried numerous formulas but I think it's going to come down to a script to help out.
I have a column with product ID's e.g.
E20067
and then I have another sheet with another column which has image url's relating to this product code such as
http://wholesale.test.com/product/E20067/web_images/E20067.jpg
http://wholesale.test.com/product/E20067/high_res/E20067.jpg
http://wholesale.test.com/product/E20067/high_res/E20067-2.jpg
What I'm wanting to do is "fuzzy" match both of these columns for their product ID, and then create a new column for each match. So it would have the product ID then on the same row in multiple columns each product image URL - like the image below:
Is there a way to do this in google sheets using a script or a formula?
In Google sheets there are a few powerful 'regex' formulas.
Suppose, you have ID list in column A, and URL list in column B
Then use formula:
=REGEXEXTRACT(B1,JOIN("|",$A$1:$A$3))
It will match one of ID's. Drag the formula down to see the result as in picture above.
See more info here
Old thread but, in case you find yourself here, search for my Google Sheets add-on called Flookup. It should do exactly what you want.
For this case, you can use this function:
Flookup (lookupValue, tableArray, lookupCol, indexNum, threshold, [rank], [range])
The parameter details are:
lookupValue: the value you're looking up
tableArray: the table you want to search
lookupCol: the column you want to search
indexNum: the column you want data to be returned from
threshold: the percentage similarity below which data shouldn't be returned
rank: the nth best match (i.e. if the first one isn't to your liking)
range: choose to return the percentage similarity or row number for each match
You can find out more at the official website (examples and such).
Please note that, whereas the OP appears to want the whole list of possible matches, Flookup will only return one result at a time.
Flookup can now return a list of all possible matches through its LRM mode.
Try the following. I am assuming the product codes are in Sheet1 and the URLs are in Sheet2. Both in column A:
=iferror(transpose(FILTER(Sheet2!$A$2:$A,Search("*"& A2 &"*",Sheet2!$A$2:$A))))
Copy down.
If you want to show the image instead of the url try:
=arrayformula(image(iferror(transpose(FILTER(Sheet2!$A$2:$A,Search("*"& A2 &"*",Sheet2!$A$2:$A))))))