Created
December 11, 2024 19:51
-
-
Save ncalm/886b5db7b5dcdc044ffd0ada78f09fa7 to your computer and use it in GitHub Desktop.
These Excel LAMBDA functions support extending TRIMRANGE to remove intermediary vectors from sparse references
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CHECKRANGE = LAMBDA(checkfn, | |
LAMBDA(directionfn, | |
LAMBDA(v, | |
directionfn(v,LAMBDA(x,AND(checkfn(x)))) | |
))); | |
CHECKISBLANK = CHECKRANGE(ISBLANK); | |
CHECKBLANKROWS = CHECKISBLANK(BYROW); | |
CHECKBLANKCOLS = CHECKISBLANK(BYCOL); | |
TRIMRANGE2 =LAMBDA(sparseRange, [compressOrRemove], | |
LET( | |
rng, TRIMRANGE(sparseRange), | |
maskFn, LAMBDA(v, | |
MAP(SEQUENCE(ROWS(v)), LAMBDA(i, | |
IF(i = 1, TRUE, | |
IF( | |
compressOrRemove, | |
NOT(INDEX(v, i)), | |
OR( | |
NOT(INDEX(v, i)), | |
AND(INDEX(v, i), NOT(INDEX(v, i - 1))) | |
)))))), | |
compressRows, FILTER(rng,maskFn(CHECKBLANKROWS(rng))), | |
TRANSPOSE( | |
FILTER( | |
TRANSPOSE(compressRows), | |
maskFn(TRANSPOSE(CHECKBLANKCOLS(rng))) | |
)))); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment