Skip to content

Instantly share code, notes, and snippets.

View ExcelRobot's full-sized avatar

Excel Robot ExcelRobot

View GitHub Profile
@ncalm
ncalm / excel-lambda-DESCRIBE.txt
Created April 14, 2022 23:12
This Excel LAMBDA function creates a table of summary statistics for an array of data
/*
DESCRIBE
Creates tables of statistics similar to the Analysis Toolpak Add-in "Summary statistics" feature.
Including support for text columns and additional statistics for numeric columns.
Inputs
- data: a range or array of data with at least one column
- has_header: TRUE if data includes a header row, FALSE otherwise
@ncalm
ncalm / excel-lambda-GROUPAGGREGATE.txt
Last active October 21, 2024 17:55
This Excel LAMBDA function creates summary tables similar to SQL GROUP BY queries
/*
GROUPAGGREGATE
Creates summary tables of data similar to SQL's GROUP BY queries
Inputs
- dat: a range or array of data with at least two columns,
one of which's control value must be "group" and one not "group"
- control: a single-row array, where COLUMNS(control)=COLUMNS(dat), of values from this list:
group - the values in this column will be output as row headers
@ncalm
ncalm / excel-lambda-RECURSIVEFILTER.txt
Last active March 7, 2025 07:10
This Excel LAMBDA function recursively applies filter criteria to an array or range
/*
RECURSIVEFILTER
Filters an array or range recursively using a list of columns and criteria to apply
Inputs
- dat: the array or range of data to filter
- cols: Either a one-dimensional horizontal array of column indices representing
columns in dat. e.g. {1,2} means "filter columns 1 and 2"
OR
@ncalm
ncalm / excel-lambda-LEV.txt
Last active September 18, 2024 11:06
This Excel LAMBDA function calculates the Levenshtein distance between two strings
/*
LEV
Calculates the Levenshtein distance between two strings
Inputs
- a: a string to compare with b
- b: a string to compare with a
- [ii]: the [ii]th position in string a
- [jj]: the [jj]th position in string b
@curioshiki
curioshiki / ave7-roc7-roc14.txt
Last active June 15, 2023 09:45
7-day average, 7-day rate of change, and 14-day rate of change functions for statistical processing
AVE7DAYS = LAMBDA(range,
iferror(average(offset(range,-6,0,7,1)),"")
);
ROC7DAYS = LAMBDA(range,ifzero,
if(row(range)>14,iferror(
if(sum(offset(range,-6,0,7,1))/sum(offset(range,-13,0,7,1))<>0,
sum(offset(range,-6,0,7,1))/sum(offset(range,-13,0,7,1)),ifzero),
ifzero),"")
)
;
@jack-williams
jack-williams / datelib
Last active November 19, 2025 00:11
Excel Date Library
/**
* Returns the day of the week for the provided date,
* where Monday is the first day.
*/
dayOfWeek = LAMBDA(datetime, WEEKDAY(datetime, 2));
/**
* Returns the name for the day of the week for the provided date.
*/
dayOfWeekName = LAMBDA(datetime, TEXT(datetime, "dddd"));
@Mohammedkb
Mohammedkb / NumberToWords.txt
Created March 18, 2022 20:53
Lambda code to be imported in Excel Advanced Formula Environment to build a customized function that converts numbers to words.
NumberToWords = LAMBDA(DNumValue, CUR, DecimalCUR, DecimalCURPlace,
LET(
NumValue, INT(DNumValue),
Words1,IFS(
len(NumValue)=1,GetDigit(value(NumValue)) & " " & CUR,
len(NumValue)=2,GetTens(value(NumValue))& " " & CUR,
len(NumValue)=3,GetHundreds(value(NumValue))& " " & CUR,
len(NumValue)<=6,GetHundreds(VALUE(left(NumValue,len(NumValue)-3))) & " Thousand " & GetHundreds(value(NumValue))& " " & CUR,
len(NumValue)<=9,GetHundreds(VALUE(left(NumValue,len(NumValue)-6))) & " Million " & GetHundreds(VALUE(left(NumValue,len(NumValue)-3))) & " Thousand " & GetHundreds(value(NumValue))& " " & CUR,
len(NumValue)<=12,GetHundreds(VALUE(left(NumValue,len(NumValue)-9))) & " Billion " & GetHundreds(VALUE(left(NumValue,len(NumValue)-6))) & " Million " & GetHundreds(VALUE(left(NumValue,len(NumValue)-3))) & " Thousand " & GetHundreds(value(NumValue))& " " & CUR),
@SergeiStPete
SergeiStPete / gistFillDown.txt
Last active June 15, 2023 10:03
Excel, Lambda - FillDown / FillUp vertical range
/* FillUp/FillDown column range functions
Sergei Baklan
Updated 2022-03-05
-------------------------------------------------------*/
/*
FUNCTION NAME: IFBLANK
based on Chris Gross function
https://gist.github.com/chgrossMSFT/d172fd552cf6893bcdc7942223cb0e55
@OscarValerock
OscarValerock / 00 M Query Gists
Last active October 26, 2025 03:34
M Query Gists
// This gist containt useful pieces of M Query code
@cwas101
cwas101 / cwasGist.txt
Last active November 25, 2024 05:26
Excel Lambda Imports
//All in 1 change formulas, EXCEPT EARNINGS RATIO------------------
//New is the column with the most recent values
//Old is the column with the older values
Change=
LAMBDA(
NEW, OLD,
IFERROR(IF(AND(LEFT(CELL("format",NEW),1)="P", LEFT(CELL("format",OLD),1)="P"),
NEW-OLD,