Skip to content

Instantly share code, notes, and snippets.

@RecalcOrDie
Last active April 9, 2022 14:24
Show Gist options
  • Save RecalcOrDie/3781d173e1963ca88ae92b5b36e6fc60 to your computer and use it in GitHub Desktop.
Save RecalcOrDie/3781d173e1963ca88ae92b5b36e6fc60 to your computer and use it in GitHub Desktop.
Variance LAMBDA Function
/*
Name: VARIANCE
Description: Variance
Author: Carlos Barboza (inspired from a post on this formula by Mike Alexander aka DataPig)
Category: Formula
*/
VARIANCE = LAMBDA(
ThisYear,
PriorYear,
IF(
OR( NOT( ISNUMBER( ThisYear ) ), NOT( ISNUMBER( PriorYear ) ) ),
"",
( ThisYear - PriorYear )
/ ABS( ThisYear * ( PriorYear = 0 ) + PriorYear )
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment