Skip to content

Instantly share code, notes, and snippets.

View ncalm's full-sized avatar
💭
hitting computer with hammer

Owen Price ncalm

💭
hitting computer with hammer
View GitHub Profile
@SergeiStPete
SergeiStPete / gist:45cbe2bd1f4062861d1738a034adeb33
Created February 13, 2022 16:52
BYROW BYCOL sample integrated aggregations
/*
calc(n) - integrates aggregation function with
BYROW() or BYCOL(), where
n - number of aggregation function
That is simple sample without error handling
and help output.
Used as:
=BYROW( range, calc(n) )
@jimpea
jimpea / lambdas.txt
Last active May 4, 2024 07:46
Some usefull Excel Lambda functions
/*
Append two ranges horizontally.
Inputs:
- range1: the first range
- range2: the second range
- default: the value entered into missing rows.
Return: The merged ranges, with empty rows filled with the default value. Missing
value within either of the two ranges filled with zeros (0). The number of rows
@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(
@over40dev
over40dev / Excel_LAMBDA_examples.txt
Last active February 23, 2024 23:41
Excel_LAMBDA_examples
/* See YouTube - Excel RECURSIVE Lambda (https://youtu.be/L7s6Dni1dG8) */
/*
FUNCTION NAME: MegaReplace
DESCRIPTION: Recursive LAMBDA for clean data given errors to look for and corrections. Recursively calls MegaReplace using Offset for Before|After table cells until end of table (i.e. blank cell)
ARGS:
text_to_correct: Contains the first table cell of data to be cleaned,
before_text: First cell of Before|After table of corrections [BEFORE] column,
after_text: First cell of Before|After table of corrections [AFTER] column
EXAMPLE:
=MegaReplace([@Skills],$F$3,$G$3) // Skills is column in main table; F | G are first cells in Before|After table
@nsolnit
nsolnit / xlTools.txt
Last active February 7, 2024 17:12
Toolbox of named excel lambdas
/**Cumulative sum over array*/
CSUM = LAMBDA(arr,
SCAN(0,arr,LAMBDA(a,c,a+c)));
/**Ignores Null ref (empty, space or 0), returns "" or VAl if provided*/
IFN = LAMBDA(REF,FUN,[VAL],
IF(OR(REF="",REF=" ",REF=0),IF(ISOMITTED(VAL),"",VAL),FUN)
);
/**1D linear interpolation, set SORTED=0 for unsorted data - presorting data recommended*/
@ExcelRobot
ExcelRobot / DIRECTPRECEDENTS.lambda
Last active January 19, 2024 05:54
Direct Precedents LAMBDA Function
/*
Name: Direct Precedents (DIRECTPRECEDENTS)
Description: Lists all direct precedents for specified cell.
Author: Excel Robot (@ExcelRobot)
Category: Formula
*/
DIRECTPRECEDENTS = LAMBDA(cell,LET(
tokens, TOKENIZEFORMULA(OFFSET(cell,0,0,1,1)),
isterm, INDEX(tokens,,1)="Term",
activesheetname, MID(CELL("filename",INDIRECT("$A$1")),FIND("]",CELL("filename",INDIRECT("$A$1")))+1,999),
@ExcelRobot
ExcelRobot / ADDTH.lambda
Last active December 21, 2023 14:59
Convert number to ordinal LAMBDA Function
/*
Name: Convert Number To Ordinal (ADDTH)
Description: Converts number to ordinal ie: 1st, 2nd, 3rd, 4th, 11th, 12th, 13th, 21st, etc.
Author: Excel Robot (@ExcelRobot)
Inspired By: Rick de Groot (https://www.linkedin.com/posts/rickmaurinus_powerbi-businessintelligence-dax-activity-6920723485937790976-Wzdb?utm_source=linkedin_share&utm_medium=member_desktop_web)
Category: Conversion
*/
ADDTH = LAMBDA(number,LET(
LastDigit, RIGHT(number),
LastTwo, RIGHT(number, 2),
@SergeiStPete
SergeiStPete / lambdaBasicFunctions.txt
Created April 23, 2022 12:18
Excel Lambda basic functions
/*
Partly taken from samples to AFE
https://github.com/microsoft/advanced-formula-environment
more exactly from
https://github.com/microsoft/advanced-formula-environment/blob/main/examples/Lib.md
*/
// ======================================================================================================
// Timing a computation wrapped in a thunk
@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),
@CHatmaker
CHatmaker / BXL LAMBDA Excel Dates.txt
Last active June 12, 2024 01:24
5g Functions for Excel: Dates
/* Module Contains 5g Compliant LAMBDAs that deal with dates */
/* FUNCTION NAME: Aboutλ
DESCRIPTION:*//**Displays the URL to this module's Gist which includes documentation*/
/* REVISIONS: Date Developer Description
Mar 17 2023 Craig Hatmaker Original Development
Mar 22 2023 Craig Hatmaker Added About
Apr 06 2023 Craig Hatmaker Added Help to LAMBDAs
Aug 28 2023 Craig Hatmaker Conformed to new template
Jan 02 2024 Craig Hatmaker See CountDOWλ