Last active
August 31, 2024 20:15
-
-
Save ncalm/7abb1afe798b63fb58eb4f115e9398fa to your computer and use it in GitHub Desktop.
Excel LAMBDA for taking a range of repeated columns, trimming each set and stacking them on top of each other
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
/* | |
For a single data with sets of 'every' columns with differing counts of rows, | |
trim each set and stack them on top of each other | |
Dependencies: | |
STACKER: | |
https://gist.github.com/ncalm/ef7ed953571eec1475c291948aa2dbc3 | |
EveryXtoN: | |
https://gist.github.com/ncalm/48b96ac45685a7897fdf0a7336b2e96b | |
*/ | |
StackEveryNColumns = LAMBDA(data, every, [header], | |
LET( | |
i, EveryXtoN(COLUMNS(data), every), | |
fn, LAMBDA(b, TRIMRANGE(CHOOSECOLS(data, b + SEQUENCE(, every, 0)))), | |
stacked, VSTACKER(fn)(i), | |
IF(ISOMITTED(header),stacked,VSTACK(header, stacked)) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment