Skip to content

Instantly share code, notes, and snippets.

@jimpea
Created February 15, 2022 16:52
Show Gist options
  • Save jimpea/765d33e18971d978e52e66fac491e6c1 to your computer and use it in GitHub Desktop.
Save jimpea/765d33e18971d978e52e66fac491e6c1 to your computer and use it in GitHub Desktop.
Excel Lambda function to stack two arrays vertically
//from <https://exceljet.net/formula/lambda-append-range>
//stack arrays vertically
APPENDRANGEV = LAMBDA(range1, range2, default,
LET(
rows1, ROWS(range1),
rows2, ROWS(range2),
cols1, COLUMNS(range1),
cols2, COLUMNS(range2),
rowindex, SEQUENCE(rows1 + rows2),
colindex, SEQUENCE(1, MAX(cols1, cols2)),
result, IF(
rowindex <= rows1,
INDEX(range1, rowindex, colindex),
INDEX(range2, rowindex - rows1, colindex)
),
IFERROR(result, default)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment