Skip to content

Instantly share code, notes, and snippets.

@ncalm
Created August 10, 2022 19:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ncalm/e5c7e44bd5db56e03a8c5e8a5035131f to your computer and use it in GitHub Desktop.
Save ncalm/e5c7e44bd5db56e03a8c5e8a5035131f to your computer and use it in GitHub Desktop.
This Excel Lambda namepace contains several functions for working with lists
ROW = LAMBDA(row,
LAMBDA(array,INDEX(array,row,))
);
/*
Gets the first row from a list
*/
FIRST = LAMBDA(array,
list.ROW(1)(array)
);
/*
Gets the last row from a list
*/
LAST = LAMBDA(array,
list.ROW(ROWS(array))(array)
);
/*
Returns TRUE if the item is in the array
*/
CONTAINS = LAMBDA(item,
LAMBDA(array,NOT(ISERROR(XMATCH(item,array))))
);
/*
Rolls the list into a CSV or similar using the given delimiter
*/
JOIN = LAMBDA([delimiter],
LET(
delim,IF(ISOMITTED(delimiter),", ",delimiter),
LAMBDA(array,
TEXTJOIN(delim, FALSE, array)
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment