I often VSTACK columns and remove empty results with FILTER like so:
FILTER(VSTACK(<filtered_column_1>;<filtered_column_2>);
VSTACK(<filtered_column_1>;<filtered_column_2>)<>0)
But I've come accross a case in which I actually want to keep blanks that are not consecutive.
Unfiltered VSTACK output:
1
2
<blank>
<blank>
<blank>
2
2
3
<blank>
3
Desired filtered VSTACK output:
1
2
<blank>
2
2
3
<blank>
3
It should technically be easy comparing each value to the previous one, but my problem is that I don't know how to reference the VSTACK output columns for comparison in the FILTER "include" argument, specially considering the columns I'm feeding as arguments to the VSTACK are not referenceable columns but rather filtered columns themselves.
FILTER(VSTACK(<filtered_column_1>;<filtered_column_2>);
<what do I do here in the "include" argument?>)
Any ideas?
Try the following formula-
=LET(x,VSTACK("",1,2,"","","",2,2,3,""),
z,MAP(SEQUENCE(ROWS(x)),LAMBDA(y,IF(AND(INDEX(x,y)="",INDEX(x,y-1)=""),FALSE,TRUE))),
FILTER(x,z))
Replace VSTACK("",1,2,"","","",2,2,3,"") with your VSTACK() formula.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With