How to determine if more than 1 or 2 years between two dates (accounting for leap years)

We issue certificates that expire the date they were issued + 1 year (or 2 years). For example, a 2-year certificate issued 6/1/23 will expire 6/1/25.

Occasionally, we get requests for special certificates that may be valid for less than or equal to the 1 year or 2 year term. We have a separate Smartsheet for approving these requests and we manually enter the dates in there for review. I need a formula to check if we accidently enter dates that are valid for more 1 year (or 2 years).

I have a formula that works correctly to verify it's not valid for more than the standard period - except if leap years are involved (see screenshot below).

How can I structure a formula that adjusts correctly if a leap year falls during the certificate period?

=IF([Standard Cert Length]@row = "1", IF(NETDAYS([Date of Issue]@row, [Expiration Date]@row) <= 366, "OK", "Exceeds 1 year"), IF(NETDAYS([Date of Issue]@row, [Expiration Date]@row) <= 731, "OK", "Exceeds 2 years"))



Best Answer

Answers

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!