Skip to content

Instantly share code, notes, and snippets.

View RecalcOrDie's full-sized avatar

carlos barboza RecalcOrDie

View GitHub Profile
@jkpieterse
jkpieterse / Excel-lambda-water97.txt
Last active April 14, 2024 12:54
Excel Lambda functions to calculate thermodynamic properties of water
cpreg1 = LAMBDA(temp, press,
LET(
tau, 1386 / temp,
pi, 0.1 * press / 16.53,
-0.001 * rgas_water * tau ^ 2 * gammatautaureg1(tau, pi)
)
);
cpreg2 = LAMBDA(temp, press,
LET(
@ncalm
ncalm / excel-lambda-OUTLIERS.txt
Created April 23, 2022 13:35
This collection of Excel lambda functions provides functionality to quickly apply the standard deviation test on a series of transformations to a continuous variable
/*
OUTLIERS
These lambda functions allow us to quickly apply the standard deviation test to a series of transformed variables
Included in this file:
OUTLIER.THRESHOLDS - for calculating outlier thresholds using a standard deviation test
inputs:
@ExcelRobot
ExcelRobot / UNPIVOT.lambda
Last active June 9, 2024 15:39
Unpivot Table LAMBDA Function
/*
Name: Unpivot Table (UNPIVOT)
Description: Given a table range with headers and array of header names, unpivots the
specified columns in place, optionally removing any blank entries.
Written By: Excel Robot (@ExcelRobot)
Category: Array
*/
UNPIVOT=LAMBDA(table,[columns_to_unpivot],[attribute_name],[value_name],[remove_blanks], LET(
_ColumnsToUnpivot, IF(
ISOMITTED(columns_to_unpivot),
// video explaining all these formulas: https://youtu.be/yO8zX_Ivcug
// see video: https://youtu.be/P8knGhzV7uk
ListTable = LAMBDA(array,
LET(one,TAKE(array,,1),two,TAKE(array,,-1),
list,UNIQUE(one),
HSTACK(list,BYROW(list,LAMBDA(x,TEXTJOIN(", ",TRUE,FILTER(two,one=x)))))));
// see video: https://youtu.be/lli7MTilTB8
repeatXtimes = LAMBDA(array,num_repeat,
@CHatmaker
CHatmaker / BXL LAMBDA Excel CrtIdxλ
Last active April 21, 2024 18:35
5g Functions for Excel: CrtIdxλ
/* FUNCTION NAME: CrtIdxλ
DESCRIPTION:*/ /**Creates an array of indexes that can be used with INDEX() can combine
all rows in all tables as would a database 'Natrual Join' or 'Cross Join.'*/
/* This was developed for multidimensional modeling. A key to multidimensional modeling
is the ability to combine all instances of all dimensions, and then access each
dimension's value. A dimension is a category of things like:
Customers, Products, Regions, Months, etc.
When faced with the situation where each dimension has a piece of information needed
for a particular calculation such as:
@halbuki
halbuki / EXNAL
Last active September 1, 2022 14:41
Excel Lambda functions for numerical analyses
/* ROOTS OF FUNCTIONS */
BISEC = LAMBDA(f, lbound, ubound, [prec],
LET(
c, (lbound + ubound) / 2,
fl, f(lbound), fu, f(ubound), fc, f(c),
IF(
ABS(fc) < MAX(prec, 1E-15),
c,
IF(
SIGN(fl) = SIGN(fc),
@halbuki
halbuki / EXLIST
Last active September 7, 2022 08:03
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));
@halbuki
halbuki / EXTAB
Last active September 6, 2022 12:02
Excel Lambda functions for Power Query Table functions
/* USE NAMESPACE "Table" */
Item = LAMBDA(_table, _index,
MAKEARRAY(
2,
COLUMNS(_table),
LAMBDA(ir, ic, CHOOSE(ir, INDEX(_table, 1, ic), INDEX(_table, _index + 1, ic)))
)
);
@halbuki
halbuki / EXREC
Last active September 6, 2022 12:34
Excel Lambda functions for Power Query Record functions
/* USE NAMESPACE "Record" */
Field = LAMBDA(_record, _field,
LET(
fieldnames, Record.FieldNames(_record),
fieldcol, List.PositionOf(fieldnames, _field),
INDEX(_record, 2, fieldcol)
)
);
@ExcelRobot
ExcelRobot / mandelbrot.lambda
Last active May 4, 2024 08:27
Mandelbrot Lambda
/*
Name: Mandelbrot Set (Mandelbrot)
Description: Generates a Mandelbrot set based on given assumptions that can be used with conditional formatting to view the visual representation.
Parameters:
xleft - Left X value
xright - Right X value
ytop - Top Y value
ybottom - Bottom Y value
size - number of columns/rows in square output range
iterations - number of iterations