Last active
September 1, 2022 17:41
-
-
Save halbuki/3243638af945b4e8edf85bebc6b56887 to your computer and use it in GitHub Desktop.
Excel Lambda functions for array manipulation
This file contains 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
REPLACENTH = LAMBDA(array, xnew, trow, [tcol], | |
LET( | |
tcol, MAX(tcol, 1), | |
MAKEARRAY( | |
ROWS(array), | |
COLUMNS(array), | |
LAMBDA(irow, icol, | |
IF( | |
AND(irow = trow, icol = tcol), | |
xnew, | |
INDEX(array, irow, icol) | |
) | |
) | |
) | |
) | |
); | |
ARRMAPLAM = LAMBDA(array, transf, [cond], | |
MAKEARRAY( | |
ROWS(array), | |
COLUMNS(array), | |
LAMBDA(ir, ic, | |
IF( | |
IF( | |
ISOMITTED(cond), | |
TRUE, | |
cond(array, ir, ic) | |
), | |
transf(array, ir, ic), | |
INDEX(array, ir, ic) | |
) | |
) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment