Last active
June 15, 2023 09:42
-
-
Save ncalm/b46398e5ae43ecdd8cfa38cb182eb60b to your computer and use it in GitHub Desktop.
This Excel lambda function returns TRUE for a leap year and FALSE for all other years
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
/* | |
ISLEAPYEAR | |
Calculates whether a year is a leap year | |
Inputs: | |
- yr is the year you want to test | |
Returns: | |
TRUE if the year is a leap year, FALSE otherwise | |
Notes: | |
Per the documentation, Excel includes a bug that treats 1900 as a leap year. | |
https://docs.microsoft.com/en-us/office/troubleshoot/excel/wrongly-assumes-1900-is-leap-year | |
*/ | |
ISLEAPYEAR =LAMBDA(yr, | |
( | |
(yr<>1900) | |
*(MONTH(DATE(yr,2,29))=2) | |
)=1 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment