The ADDYEARS function adds a number of years to a date.
For example, you can use the ADDYEARS function to show a customer's contract end date.
Syntax
ADDYEARS(Date, number)
Arguments
Argument | Data type | Description |
Date | Date | The date to add years to. |
Number | Number | The number of years to add to the date. |
The ADDYEARS function returns a date result.
Calculation engine functionality differences
In Polaris, if you use a value of NaN (Not a Number) for the Number argument, the ADDYEARS function returns a blank value.
In the Classic Engine, a value of NaN used with ADDYEARS is equivalent to 0.
Additional information
If you want to subtract the number of years from a date in a formula, you can use negative numbers. For example, ADDYEARS(Amended contract date, -2)
.
Excel equivalent function
Examples
In this example, a Contract Details module has line items on rows, and the Customers list on columns. Both line items have a date format.
The formula returns the date two years after the customer's contract start date.
Customer A | Customer B | |
Contract start date | 01/01/2021 | 01/06/2021 |
Contract end date
| 01/01/2023 | 01/06/2023 |
If you want to add years and days to a date, you can use additional numbers in your formula. In this example, the formula returns the date one year and seven days after the contract start date.
Customer A | Customer B | |
Contract start date | 01/01/2021 | 01/06/2021 |
Contract end date
| 08/01/2022 | 08/06/2022 |