filter with multiple regexmatch? - regex

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.

Related

if and search function on power BI token literal expected

I have a table called "food suppliers" with a column called "sites" that have multiple countries ending in ".com", ".es", ".co.uk".
I want to create a new column that separates these sites into their corresponding country names using the if and search function on power query.
so far in power query custom column I have:
Country = IF (SEARCH ("*.com", foodsuppliers[sites],,0) = 0, IF (SEARCH ("*.es", foodsuppliers[sites],, 0)= 0, "Spain","UK"),"USA")
But I am getting a "token literal expected" under the first = sign in "IF (SEARCH ("*.com", foodsuppliers[sites],,0) = 0"
does any one have ideas why or a better way to run this code on power query/power bi?
thanks.
Nothing in your code seems relevant
There is no SEARCH function, you want to use Text.Contains
You cant write foodsuppliers[sites] or you will be getting the entire column of all rows. You probably want each current row, which you would get with [sites]
This is not excel where you can do =if (xxx,fff,zzz) the format is if x then y else z
I recommend some tutorials

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.

array formula and regexmatch won't follow through whole column

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.

classic report and derived columns

I have a classic report 2 columns are coming from the table and the 3rd column is a derived column.
I want to compute the values of the 3rd column based on the value of the 2nd column like if the 2nd column value is 1 then I want to put '-' in the 3rd column if it is >1 then in the 3rd column I want to put 'More than one dates'
And I want to have filters in the 3rd column header with the values that I put, I this case '-' and 'More than one dates'
And when I select the filters I want the report to be filtered accordingly.
I have a put a screen shot of the report.
Please can anyone let me know how to accomplish this.
Any help will be more than welcome
Apex 5.1 and Firefox
Snap Shot of the Report
Your SELECT-Statement should look something like this:
select ULA_ORDER_NUMBER,
COUNT,
CASE WHEN COUNT = 1 THEN '-' ELSE 'More than one dates' END as FILTER
from YOUR_TABLE
For the filter just "double click" on the COUNT column header.
This is what it looks like:
Hope this helps you.

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))))))