I am trying to use the filter function but I'm having trouble remembering if this is even the correct formula I should be using. I want to take any items that have information in the D, G and J columns to create a new list.
=FILTER('Floor 5 Sweep'!A2, 'Floor 5 Sweep'!D2<>"","")
This semi works but leaves a lot of blanks in between as below:
Here is a formula which lets you choose which columns you wish to consider in a single function (CHOOSECOLS
)
=FILTER(
$A$2:$A$21,
BYROW(
CHOOSECOLS($A$2:$L$21, 4, 7, 10),
LAMBDA(arr, OR(arr <> ""))
)
)
Note that the column numbers in the CHOOSECOLS
function can also be represented by an array of numbers generated by the SEQUENCE
function. So if there is a pattern, it can easily be extended. For example, the above formula would be equivalent to:
=FILTER(
$A$2:$A$21,
BYROW(
CHOOSECOLS(
$A$2:$L$21,
SEQUENCE(3, , 4, 3)
),
LAMBDA(arr, OR(arr <> ""))
)
)
so if you wanted to include also columns M
and P
you would make just two changes in the CHOOSECOLS
function as seen below:
=FILTER(
$A$2:$A$21,
BYROW(
CHOOSECOLS(
$A$2:$P$21,
SEQUENCE(5, , 4, 3)
),
LAMBDA(arr, OR(arr <> ""))
)
)