Google Sheet REGEXMATCH with range - google-sheets

I want to search specific text in an entire column, the text to be searched is in another column. I am using below formula:
=ARRAYFORMULA(if(isblank(A2:A),"",IFERROR(if(REGEXMATCH(UPPER(A2:A), B2:B4),"Yes","No"),"Not Found")))
This function is comparing cell A2 with B2, A3 with B3 and so on.... I want to compare A2 with B2:B4, A3 with B2:B3...
Below is the sheet link:
https://docs.google.com/spreadsheets/d/164kxDO9aWZzr5qXjvtRlk_tiRoKU1W7Xc-Ig9VH8qzE/edit#gid=495498161
Any help on above will be greatly appreciated....

Change your formula to
=ARRAYFORMULA(if(isblank(A2:A),"",IFERROR(if(REGEXMATCH(UPPER(A2:A), TEXTJOIN("|", 1, B2:B4)),"Yes","No"),"Not Found")))
Or, in case you want an exact match:
=ARRAYFORMULA(if(isblank(A2:A),"",IFERROR(if(REGEXMATCH(UPPER(A2:A), ".*"&TEXTJOIN("|", 1, B2:B4)&".*"),"Yes","No"),"Not Found")))
Also see the duplicated sheet in the spreadsheet you shared.
See if that works?

Related

How to correct XLOOKUP Formula result Error with query

i created year expenses sheet with query, xlookup formula in google sheet. now getting error with xlookup formula. can u check my google sheet and correct xlookup formula. i share my sheet
https://docs.google.com/spreadsheets/d/106FpEvx5NBo_bX_0XyBVBsZhotYqMFzGkMYI_JFpRwE/edit?usp=sharing
pl correct my xlookup formula
my code
=QUERY(DATA!B2:D, "WHERE B CONTAINS '"&XLOOKUP(B2,DATA!H2:H,DATA!I2:I)&"' ",0)
added formula to your sheet. Please check it out:
=ARRAYFORMULA(QUERY({DATE(RIGHT(DATA!B2:B,4),MID(DATA!B2:B,4,2),LEFT(DATA!B2:B,2)),DATA!C2:D},"SELECT *"&IF(B2="2022 ALL MONTH EXPENSES",," WHERE MONTH(Col1) = "&MONTH(XLOOKUP(B2,DATA!H3:H,DATA!I3:I))-1)))

Combine multiple sheets with same amount of columns but different amount of rows

Given two sheets that look like this:
Sheet1
a1 b1
a1 b1
Sheet2
a2 b2
a2 b2
a2 b2
How could I query for both sheets and combine all the rows together to get something line
Combined
a1 b1
a1 b1
a2 b2
a2 b2
a2 b2
I have tried the following but none of them worked
={QUERY({'Sheet1'!A1:B},"select *");QUERY({'Sheet2'!A1:B},"select *")}
=QUERY({'Sheet1'!A1:B;'Sheet2'!A1:B},"select *")
The problem with both is that I don't specify what row to end at for the two sheets. If I changed it to =QUERY({'Sheet1'!A1:B2;'Sheet2'!A1:B3},"select *"), then it would work. The problem with this is that in my actual spreadsheet, the number of rows in the sheets is changing as I am inputting more data and I would rather not have to update the query everytime.
You were close. Include the full possible ranges and add a bit to the "Select" clause:
=QUERY({Sheet1!A:B;Sheet2!A:B},"Select * Where Col1 Is Not Null")
This returns only the non-null (i.e., existing) data from each sheet.

ArrayFormula, SumProduct and Google Sheets returning only 1 value

I have two sheets. I'm using SUMPRODUCT to sum a column based on a matching string.
=SUMPRODUCT(--(skus_campaign!A:A=A2),skus_campaign!D:D)))
This works exactly as expected, if I drag the formula to the rows below.
If I attach ARRAYFORMULA and and IF test to see if there's a blank value, it won't work.
=ARRAYFORMULA(IF(ISBLANK(A2:A), " ", SUMPRODUCT(--(skus_campaign!A:A=A2),skus_campaign!D:D)))
Am I missing something here? Is there an easier way to accomplish this while still using ARRAYFORMULA to grow and shrink the column based on the values in column A?
EDIT: Here's the link to the example Google Sheet. Column "D" under the "Data" sheet is the issue.
Try in E1
={"COGS"; ArrayFormula(if(len(A2:A), vlookup(A2:A, query(skus!A:D, "Select A, sum(D) where A <>'' group by A"), 2, 0),))}
and see if that produces the desired result. If it does, clear all values and formulas in column D and enter the formula in D1.

Combination of VLOOKUP and IMPORTRANGE in an array formula doesn't work

I would like to import some data with the combination of ARRAYFORMULA, VLOOKUP, and IMPORTRANGE like this:
=arrayformula(vlookup(A3:A,importrange(T3:T,"sheet1!A:AA"),21,false))
in column T, there are individual sheet URLs.
However, this doesn't work because the formula only uses sheet URL in T3 than in another row other than row 3, it says #N/A because the value in A4 doesn't appear on a sheet URL in T3, where sheet URL must be the one in T4.
How to correct the formula above?
IMPORTRANGE does not support array range reference input.
the workaround would be to use multiple IMPORTRANGEs in an array like:
=ARRAYFORMULA(IFERROR(VLOOKUP(A2:A, {IMPORTRANGE(T2, "sheet1!A:AA");
IMPORTRANGE(T3, "sheet1!A:AA");
IMPORTRANGE(T4, "sheet1!A:AA")}, 21, 0), ))

Add Filter to Vlookup formula Google sheets

I know verry little about formulas
I have a Vlookup formula which is working
=ArrayFormula(iferror(vlookup(ConnectionHelper!M2:M, ConnectionHelper!$D$2:$E, {2,1}, false)))
I want to FILTER out rows if a cell in column D is empty
But not getting how or ever if possible!
I am trying
=Filter(ArrayFormula(iferror(vlookup(ConnectionHelper!M2:M, ConnectionHelper!$D$2:$E, {2,1}, false))),D2:D<>'')
Thanks
Try
=query(ArrayFormula(iferror(vlookup(ConnectionHelper!M2:M, ConnectionHelper!$D$2:$E, {2,1}, false))), "where Col2 <>''")
(assuming your data in column D is text).

Resources