Skip to content

Instantly share code, notes, and snippets.

@SergeiStPete
Created February 13, 2022 16:52
Show Gist options
  • Save SergeiStPete/45cbe2bd1f4062861d1738a034adeb33 to your computer and use it in GitHub Desktop.
Save SergeiStPete/45cbe2bd1f4062861d1738a034adeb33 to your computer and use it in GitHub Desktop.
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) )
Sergei Baklan
Initial version: 2022-02-10
Updated: 2022-02-13
----------------------------------------------*/
thunk = LAMBDA( x, LAMBDA(x) );
calc= LAMBDA(n,
LAMBDA(a,
thunk(
CHOOSE(n
, AVERAGE(a) // 1
, COUNT(a) // 2
, COUNTA(a) // 3
, MAX(a) // 4
, MIN(a) // 5
, PRODUCT(a) // 6
, STDEV.S(a) // 7
, STDEV.P(a) // 8
, SUM(a) // 9
)
)()
) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment