Skip to content

Instantly share code, notes, and snippets.

@SergeiStPete
SergeiStPete / CreateDynamicColumns.txt
Created August 2, 2022 19:39
Creating Dynamic Columns - Office Scripts
// Creating Dynamic Columns challenge
function main(workbook: ExcelScript.Workbook) {
// Extract
const selectedSheet = workbook.getWorksheet("Challenge")
const source = selectedSheet.getTable("Source")
let names = source.getColumnByName("Name")
// variants to https://gist.github.com/havishmad/0f8e5f785146633f0f8533b5820dd0fe
insertBlankRows=
LAMBDA( data,
LET(
columnsInRange, COLUMNS(data),
emptyRow, IF( SEQUENCE(, columnsInRange ), ""),
rowsInRange, ROWS( data ),
addEmptyRow, VSTACK( TAKE( data, 1), emptyRow),
IF( rowsInRange = 1,
@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
@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
@SergeiStPete
SergeiStPete / gist:8a721d4e2461bb6a91eb3679360d45e6
Last active June 15, 2023 10:04
EXCEL SplitText() with Lambda
/*
Waiting for a native function simple SPLITTEXT() is here.
- no error handling
- no help string
- separators between quotes are not ignored
Use:
=SPLITTEXT( text, separators )
if separator is missed comma is taken by default
examples:
@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) )