Created
November 22, 2023 18:58
-
-
Save ncalm/f32c1a16f531e4875d30c9475677fa07 to your computer and use it in GitHub Desktop.
This Excel LAMBDA gist replicates PERCENTOF functionality for other aggregates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Replicating PERCENTOF for non-SUM aggregates | |
Usage: | |
For percent of max: | |
=PERCENTOFFN(MAXL)(data_subset,data_all) | |
In GROUPBY function argument: | |
PERCENTOFFN(MAXL) | |
Note: At this time, this doesn't work: | |
=PERCENTOFFN(MAX)(data_subset,data_all) | |
In GROUPBY function argument: | |
PERCENTOFFN(MAX) | |
*/ | |
MAXL = LAMBDA(a,MAX(a)); | |
SUML = LAMBDA(a,SUM(a)); | |
AVGL = LAMBDA(a,AVERAGE(a)); | |
MINL = LAMBDA(a, MIN(a)); | |
// etc | |
PERCENTOFFN = LAMBDA(function, | |
LAMBDA(data_subset, data_all, | |
function(data_subset) / function(data_all) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment