I'm trying to create a column containing a category based on a set of categories and a match/regex string from another range. My example is:
I can't find any answered questions here which explain to me how this can be done, if it can. So am asking here if anyone can help or point me toward an answer I've probably missed!
Neither the category or data ranges will be a static number of rows. I'd like to have a formula which simply produces something like this:
Any help very much appreciated!
try:
=ARRAYFORMULA(IFNA(REGEXEXTRACT(E2:E, "["&TEXTJOIN( , 1, B2:B)&"]")))
update 1:
=INDEX(IFNA(REGEXEXTRACT(E2:E, "["&TEXTJOIN( , 1,
REGEXREPLACE(C2:C, "[\.\*]", ))&"]")))
or:
=INDEX(IFNA(VLOOKUP(IFNA(REGEXEXTRACT(E2:E, "["&TEXTJOIN( , 1,
REGEXREPLACE(C2:C, "[\.\*]", ))&"]")), {
REGEXREPLACE(C2:C, "[\.\*]", ), B2:B}, 2, 0)))
update 2
first of all, learn your regex: https://github.com/google/re2/wiki/Syntax
change your C column to:
.*(A).*
.*(B).*
.*(C).*
then use:
=ARRAYFORMULA(IFNA(VLOOKUP(TRIM(FLATTEN(QUERY(TRANSPOSE(
IFNA(REGEXEXTRACT(E3:E, TEXTJOIN("|", 1, C3:C)))),,9^9))), {
IFNA(REGEXEXTRACT(C3:C, TEXTJOIN("|", 1, TRIM(FLATTEN(QUERY(TRANSPOSE(
IFNA(REGEXEXTRACT(E3:E, TEXTJOIN("|", 1, C3:C)))),,9^9)))))), B3:B}, 2, 0)))
or shorter:
=INDEX(IFNA(VLOOKUP(
IFNA(REGEXEXTRACT(E3:E, "["&TEXTJOIN("|", 1, C3:C)&"]")), {
IFNA(REGEXEXTRACT(C3:C, TEXTJOIN("|", 1,
IFNA(REGEXEXTRACT(E3:E, "["&TEXTJOIN("|", 1, C3:C)&"]"))))), B3:B}, 2, 0)))
Related
I would like this multiple-criteria query not to show empty columns.
=QUERY({H3:M11}, "select * WHERE
"&TEXTJOIN(" and ", 1,
IF(C3<>"", "Col2 = "&C3&"", ),
IF(B3<>"", "Col3 = '"&B3&"'", )), 1)
Besides, I would also like to know if it's possible to filter it outside a query formula. Currently, I have this formula made by #player0 which is excluding columns with values greater than 0, but I didn't manage to make it work for text.
=FILTER(FILTER(H3:M11, LEN(TRIM(QUERY(IFERROR(1/(1/H4:M11)),,9^9)))>0), {9;
LEN(TRIM(FLATTEN(QUERY(TRANSPOSE(IFERROR(1/(1/H4:M11))),,9^9))))}>0)
Link to the question where this filter formula was found.
Here's the sheet.
Thanks a lot.
try:
=ARRAYFORMULA(QUERY({H3:K11,
FILTER(L3:M11, TRIM(QUERY(L4:M11,,9^9))<>"")},
"where "&TEXTJOIN(" and ", 1,
IF(C3<>"", "Col2 = "&C3&"", ),
IF(B3<>"", "Col3 = '"&B3&"'", )), 1))
I have a Google Sheet that imports column "L" from another file based on the row number
=ArrayFormula(
IF(LEN(K:K),
if( ROW(L:L) = 1,
"Date",
IMPORTRANGE("https://docs.google.com/spreadsheets/d/123456123456lkjjj","Sheet1!D" & M1:M)
),""
)
)
other file (Sheet1)
The problem always return the first result
Try this:
=ARRAYFORMULA(
IFS(
ROW(L:L) = 1,
"Date",
K:K = "",,
True,
IFNA(VLOOKUP(
M:M,
{
SEQUENCE(ROWS(IMPORTRANGE("https://docs.google.com/spreadsheets/d/123456123456lkjjj", "Sheet1!D:D"))),
IMPORTRANGE("https://docs.google.com/spreadsheets/d/123456123456lkjjj", "Sheet1!D:D")
},
2,
))
)
)
IMPORTRANGE works once inside ARRAYFORMULA, so it is not possible to call it in a loop. But you can get everything with it and then loop through it.
I am trying to nest the following two formulas, both work.
cell AO2 = Bob, cell AP2 = Judy
=TEXTJOIN(\"|\", True, AO2, AP2) = Bob|Judy
=SUBSTITUTE(ADDRESS(1,MATCH("*sumAppTags",Elements!A1:BB1,0),4),1,"") = Column Index AO
If I try:
=TEXTJOIN("|", True, SUBSTITUTE(ADDRESS(1,MATCH("*sumAppTags",Elements!A1:BB1,0),4),1,"")&2, AP2)
I get: AO2|Judy
Is there a way to get this to work?
try:
=TEXTJOIN("|", 1, INDIRECT(SUBSTITUTE(ADDRESS(1,
MATCH("*sumAppTags", Elements!A1:BB1, 0), 4), 1, )&2), AP2)
Need to know how to put Max Offset function into array formula.
=ArrayFormula(MAX(OFFSET(M42:M46,0,0,5,1)))
This is what I am wanting to change it from.
=MAX(OFFSET(M42,0,0,5,1))
Here is the example in sheets.
https://docs.google.com/spreadsheets/d/180M_qJCE0Bhz5jRX-tAyBc7DIp7HQpCNVGGlrkuguso/edit?usp=sharing
why not:
=ARRAYFORMULA(QUERY(TRANSPOSE(QUERY(TRANSPOSE(ARRAY_CONSTRAIN(SPLIT(TRANSPOSE(QUERY(
TRANSPOSE(ARRAY_CONSTRAIN(IF(IFERROR(SPLIT({"";REPT("♦"&ROW(INDIRECT("A1:A"&COUNTA(M42:M))),
ROW(INDIRECT("A1:A"&COUNTA(M42:M))))}, "♦"))<>"", , TRANSPOSE(SPLIT(REPT(
INDIRECT("M42:M"&COUNTA(M42:M)+41)&" ", COUNTA(M42:M)-5+1), " "))),
COUNTA(M42:M)-5+1, COUNTA(M42:M))), , COUNTA(M42:M))), " "), COUNTA(M42:M)-5+1, 5)),
"select "&TEXTJOIN(",", 1, IF(LEN(TRANSPOSE(SPLIT(REPT("♥♠", COUNTA(M42:M)-5+1), "♥"))),
"max(Col"&ROW(A1:A)&")", ))&"")),
"select Col2"))
When I use the filter or query to get the result, I want to get the address of the result.
The result is a string type, But column() or row() methods just accept the range on the parameter.
Is there any method to get the address?
Such like the original function address(1,2,4) result (B1)
=CELL("address", INDEX(A2:A, MATCH(
FILTER(A2:A, A2:A="Nancy"),
A2:A, 0), 1))
_______________________________________________________________
=REGEXREPLACE(CELL("address", INDEX(A2:A, MATCH(
FILTER(A2:A, A2:A="Nancy"),
A2:A, 0), 1)), "\$", "")