Skip to content

Instantly share code, notes, and snippets.

View Medohh2120's full-sized avatar

Medohh2120

View GitHub Profile
@Medohh2120
Medohh2120 / FILL.LAMBDA
Last active April 30, 2026 12:56
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 April 14, 2026 12:28
Versions of BYROW, BYCOL, MAP that can return nested arrays
/*
Name: BYROW⊟
Description: A high-performance version of BYROW that supports "Array of Arrays" (nested results).
[orient] logic to control the assembly of results:
(0) or Omitted: (Stacks each row result vertically).
(1) : (Stacks each row result horizontally).
Made By: Medohh2120
*/
BYROW⊟ = LAMBDA(array, function, [orient],
@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 March 24, 2026 19:06
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(
@Medohh2120
Medohh2120 / Textbetween.lambda
Last active February 28, 2026 00:11
Returns text between 2 delimiters
/*
Name: TEXTBETWEEN
Description: Returns text between delimiters.
- Standardized to native TEXTAFTER/BEFORE syntax.
- Supports Multi-input: Text (Rows) x Delimiters (Columns).
- Strict Mode: Assumes equal number of start/end delimiters.
Made By: Medohh2120
*/
TEXTBETWEEN = LAMBDA(text, start_delim, end_delim, [instance_start], [instance_end], [case_sensitive_start], [case_sensitive_end], [match_end_start], [match_end_end], [if_not_found],
@Medohh2120
Medohh2120 / Unpivot_Toolkit.lambda
Last active April 24, 2026 21:13
Unpivot "Wide" data into a "Long" database format (Supports Multiple headers/columns)
/*
Name: UNPIVOT_PLUS
Description: Given a table or a range with headers, Transforms "Wide" data into a "Long" database format.
V4 UPDATE: "pad_blanks_with" feature to replace empty grid cells (prevents Pivot Table type-errors).
Automatically handles merged cells (Fill-Down or Fill-Right logic).
optionally removing Grid blank entries.
optionally removing Grid errors.
Made By: Medohh2120
*/