Skip to content

Instantly share code, notes, and snippets.

@halbuki
halbuki / EX_Number
Last active March 10, 2026 20:49
Excel Lambda functions for Power Query Number functions
/* USE NAMESPACE "Number" */
Abs = LAMBDA(
_number,
LET(
// Help
Help, TRIM(TEXTSPLIT(
"DESCRIPTION:->Returns the absolute value of a number\nVERSION:->1.0\nPARAMETERS:->_number as number",
"->",
"\n"
@halbuki
halbuki / EX_Replacer
Last active March 10, 2026 20:49
Excel Lambda functions for Power Query Replacer functions
/* USE NAMESPACE "Replacer" */
ReplaceText = LAMBDA(_text, _old, _new,
LET(
Help, TRIM(TEXTSPLIT(
"DESCRIPTION:->Replaces all occurrences of _old with _new in _text\nVERSION:->1.0\nPARAMETERS:->_text as text, _old as text, _new as text",
"->",
"\n"
)),
ErrorMessages, {"_text is not text."; "_old is not text."; "_new is not text."},
@halbuki
halbuki / EX_Text
Last active March 10, 2026 20:51
Excel Lambda functions for Power Query Text functions
/* USE NAMESPACE "Text" */
AfterDelimeter = LAMBDA(_text, delimiter, [_index],
LET(
Help, TRIM(TEXTSPLIT(
"DESCRIPTION:->Returns the part of _text after the given delimiter. If _index is omitted, returns after the first delimiter\nVERSION:->1.0\nPARAMETERS:->_text as text, delimiter as text, _index as number (optional)",
"->",
"\n"
)),
ErrorMessages, {"_text is not text."; "delimiter is not text."; "_index is not a number."},
@halbuki
halbuki / EX_Record
Last active May 24, 2025 16:38
Excel Lambda functions for Power Query Record functions
/* USE NAMESPACE "Record" */
Field = LAMBDA(
// Parameter Declarations
_record,
_field,
LET(
// Help
Help, TRIM(
@halbuki
halbuki / EX_Table
Last active March 10, 2026 20:54
Excel Lambda functions for Power Query Table functions
/* USE NAMESPACE "Table" */
Item = LAMBDA(_table, _index,
LET(
// Help
Help, TRIM(TEXTSPLIT(
"DESCRIPTION:->Returns the row at position _index from _table including the header row\nVERSION:->1.0\nPARAMETERS:->_table as table, _index as number",
"->",
"\n"
)),
@halbuki
halbuki / EX_List
Last active March 10, 2026 21:13
Excel Lambda functions for Power Query List functions
/* USE NAMESPACE "List" */
Accumulate = LAMBDA(_list, _seed, _accumulator, REDUCE(_seed, _list, _accumulator));
AllTrue = LAMBDA(_list, AND(_list));
AnyTrue = LAMBDA(_list, OR(_list));
Average = LAMBDA(_list, AVERAGE(_list));
Contains = LAMBDA(_list, _value, [_equationCriteria],
@halbuki
halbuki / EXARR
Last active March 10, 2026 20:55
Excel Lambda functions for array manipulation
/* USE NAMESPACE "ARR" */
REPLACENTH = LAMBDA(array, xnew, trow, [tcol],
LET(
// Help
Help, TRIM(TEXTSPLIT(
"DESCRIPTION:->Replaces the element in array at row trow and column tcol with xnew. If tcol is omitted it defaults to 1.\nVERSION:->1.0\nPARAMETERS:->array as array, xnew as any, trow as number, tcol as number (optional)",
"->",
"\n"
)),
@halbuki
halbuki / EX_NumericalMethods
Last active May 24, 2025 18:09
Excel Lambda functions for numerical analyses
Template = LAMBDA(
// Parameter Declarations
x,
LET(
// Help
// Error Messages
// Check Inputs
// Procedure
// Handle Error
// Return Result