Last active
June 15, 2023 09:45
-
-
Save curioshiki/0416d239b34767648b74c62144cf1bd0 to your computer and use it in GitHub Desktop.
7-day average, 7-day rate of change, and 14-day rate of change functions for statistical processing
This file contains hidden or 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
| AVE7DAYS = LAMBDA(range, | |
| iferror(average(offset(range,-6,0,7,1)),"") | |
| ); | |
| ROC7DAYS = LAMBDA(range,ifzero, | |
| if(row(range)>14,iferror( | |
| if(sum(offset(range,-6,0,7,1))/sum(offset(range,-13,0,7,1))<>0, | |
| sum(offset(range,-6,0,7,1))/sum(offset(range,-13,0,7,1)),ifzero), | |
| ifzero),"") | |
| ) | |
| ; | |
| ROC14DAYS = LAMBDA(range,ifzero, | |
| if(row(range)>28,iferror( | |
| if(sum(offset(range,-13,0,14,1))/sum(offset(range,-27,0,14,1))<>0, | |
| sum(offset(range,-13,0,14,1))/sum(offset(range,-27,0,14,1)),ifzero) | |
| ,ifzero),"") | |
| ) | |
| ; | |
| RATELASTWEEK = LAMBDA(range, | |
| iferror( | |
| VALUE(range)/value(offset(range,-7,0,1,1)) | |
| ,"" | |
| ) | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment