Created
April 23, 2022 12:18
-
-
Save SergeiStPete/1a52bdcc39e5e891d4aa6ab83eeebe40 to your computer and use it in GitHub Desktop.
Excel Lambda basic functions
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
/* | |
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 | |
calculationTime = LAMBDA(thunk, | |
LET( start, NOW() | |
, value, thunk() | |
, end, NOW() | |
, days, end - start | |
, ms, days * 24 * 60 * 60 * 1000 // milliseconds (resolution 10ms on desktop) | |
, ms_round, round(ms,0) | |
, "Calc time: " & ms_round & " ms" | |
) | |
); | |
// ====================================================================================================== | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment