I'm trying to search within certain columns but then output all columns. For example, with an excel file containing two sheets:
Sheet1:
A B C
Col1 Col2 Col3
foo foo NA
bar 2 y
baz foo bar
foo bar z
bar 5 NA
baz 6 foo
Sheet2:
A B C
Col1 Col2 Col3
1 7 foo
bar foo bar
baz 9 bar
foo foo z
bar 11 y
baz foo NA
Currently I have this formula which displays all columns based on a string match in any of the columns:
=LET(w,WRAPROWS(TOCOL('Sheet1:Sheet2'!A:C,1),3), FILTER(w,BYROW(ISNUMBER(SEARCH("foo",w)), LAMBDA(b,OR(b)))))
foo foo NA
baz foo bar
foo bar z
baz 6 foo
1 7 foo
bar foo bar
foo foo z
baz foo NA
However, I would like to restrict the search to only columns Col1
and Col2
, but still display all columns:
Col1 Col2 Col3
foo foo NA
baz foo bar
foo bar z
bar foo bar
foo foo z
baz foo NA
How should I change the formula to achieve this result?