Skip to content

Instantly share code, notes, and snippets.

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