Skip to content

Instantly share code, notes, and snippets.

View Medohh2120's full-sized avatar

Medohh2120

View GitHub Profile
@Medohh2120
Medohh2120 / Nested arrays toolkit
Created October 9, 2026 20:21
ARRDEPTH(), ISRAGGED: Calculate array depth and validate array uniformity (ragged vs. uniform layouts) in Excel.
/*
Name: ARRDEPTH
Description: Final user interface (Use this). Returns how many levels an array is nested.
[is_ragged]: TRUE finds the deepest array path. FALSE or Omitted assumes uniform layout and only tests the first element's path for speed.
Made By: Medohh2120
*/
ARRDEPTH = LAMBDA(array, [is_ragged], IF(is_ragged, ANALYZE_NESTING(array,1), LINEARDEPTH(array)));
/*
Name: ISRAGGED
@Medohh2120
Medohh2120 / Syntactic Sugar Helper Functions.txt
Last active October 6, 2026 11:03
A collection of custom Excel LAMBDA functions designed as syntactic sugar to improve code readibility.
/*
Name: ISIN
Description: Element-wise membership test (SQL IN clone). Returns TRUE/FALSE for each value in array.
Deals errors as identical matches.
Recommendation: Leave [Use_Xmatch] omitted (0) for standard lookups; MATCH is significantly faster than XMATCH on exact matches.
[Use_Xmatch]: 0 or Omitted (Fast MATCH), 1 (XMATCH). User is responsible for parameters if 1.
[Match_mode]: Default 0 (Exact match) for safety.
[Search_mode]: Controls XMATCH search direction (only evaluated if Use_Xmatch is 1).
[case_sensitive]: 0, FALSE, or Omitted (Case-insensitive matching), 1 or TRUE (Strict case-sensitive matching). Note: Activating this short-circuits the formula and bypasses all other optional parameters.
Made By: Medohh2120
@Medohh2120
Medohh2120 / DESCRIBE.lambda
Last active October 6, 2026 11:05
Excel's version of python's DESCRIBE() function
/*
Name: DESCRIBE
Description: Generates a descriptive-statistics summary for each selected column,
similar to Python's pandas .describe() function.
[isSample] default: TRUE; uses sample variance, standard deviation, and skewness.
[include] default: 0; 0 = numeric columns, 1 = text columns, 2 = all columns.
[Has_hdrs?] default: TRUE; specifies whether the first row contains headers.
Made By: Medohh2120
@Medohh2120
Medohh2120 / FILL.LAMBDA
Last active August 4, 2026 09:20
Fills blank cells Down/Up/Right/Left on 2D arrays. Supports chained directions. ( {"d", "r", ...} ) with high performance.
/*
Name: FILL
Description : Fills blank cells of an array in a given direction.
Supports 2D arrays.
Supports multiple directions via array constant {"d", "r", ...} respectively ⚠.
[directions]: control Filling direction:
"d" or Omitted (down).
"u" (up).
"r" (right).
"l" (left).
@Medohh2120
Medohh2120 / WRAPROWS_AT.LAMBDA
Last active May 2, 2026 23:40
Wraps a column into rows at every occurrence of a trigger value. Use case: each “record” is a vertical block cells, and blocks are separated a given separator. The blocks are not a fixed size.
/*
Name: WRAPROWS_AT
Description: Wraps a column into rows at every occurrence of a trigger value.
Supports multiple triggers via array constant {"start", "end", ...}.
⚠ Triggers are not case-sensitive "end" and "END" are treated the same.
Consecutive triggers in data are automatically treated as one -> no empty groups produced.
Groups are internally joined via CHAR(1) as a safe delimiter, never colliding with real data.
Optional "pad_with" pads shorter rows to uniform width.
⚠ Note: TEXTJOIN cap applies -> max ~32,000 chars per group.
Made By: Medohh2120
@Medohh2120
Medohh2120 / Groupby_Retitle.lambda
Created March 26, 2026 17:08
Fixes GROUPBY+ HSTACK value field headers
/*
Name: GROUPBY_RETITLE
Description: Replaces the native (GROUPBY+HSTACK) value field headers with provided [custom_headers] array.
GROUPBY.[Field_headers] must equal 2 or 3.
Made By: Medohh2120
*/
GROUPBY_RETITLE = LAMBDA(groupby_result, [custom_headers],
LET(
n_value_fields, SUM(--(TAKE(groupby_result, 1) <> "")),
@Medohh2120
Medohh2120 / SpillNests.lambda
Last active October 9, 2026 12:42
Versions of BYROW, BYCOL, MAP that can return nested arrays (Now with Compatibility V.3 integration)
/*
Name: COMPATVER
Description: Dynamically switches between legacy, dynamic-array, and modern Excel engines
to return the current compatibility level: 1, 2, or 3.
Made By: Medohh2120
*/
COMPATVER = LAMBDA(
SWITCH(
TRUE,
@Medohh2120
Medohh2120 / BENCHMARK.lambda
Last active March 16, 2026 04:13
BENCHMARK — Excel LAMBDA Performance Timer
/*
Name: BENCHMARK
Description: Runs a formula N iterations and returns avg & total execution time.
Func must be wrapped in LAMBDA() =BENCHMARK(LAMBDA(your_formula), 50)
[iterations] default: 1
[time_unit] default: 0 (ms), 1 = seconds
Because this function uses NOW(), manual calculation mode is highly recommended.
Made By: Medohh2120
*/
@Medohh2120
Medohh2120 / DynArray-ShapeShift.lambda
Last active August 26, 2026 14:11
Dynamic array transformation toolkit for Excel LAMBDA functions
/*
Name: REPLACE_VECTOR
Description: Replaces targeted rows and/or columns in an array with given "new_arrays".
If multiple indices are supplied per axis, the same "new_array" is placed at each target.
preserves the original order of the remaining rows/columns.
Optional "pad_with" replaces dimension-mismatch errors in the final result.
Made By: Medohh2120
*/
REPLACE_VECTOR = LAMBDA(array, [row_idxs], [new_row_array], [col_idxs], [new_col_array], [pad_with],
@Medohh2120
Medohh2120 / Repeat.lambda
Last active May 3, 2026 16:12
a High performance function that repeats a data range based on a frequency column
/*
Name: REPEAT
Recommended version: v2024 or 365
Description: Repeats a data range based on a frequency column.
Optimized with Binary Search.
Made By: Medohh2120
*/
Repeat = LAMBDA(Values,Number_times,
LET(