How to add/subtract months from given date in Excel

As far as I did not found answer here on superuser I post my own answer:

According to this link Excel: Adding/Taking n Month(s) to a Date. Add Months to an Excel Date you have to:

  • Enable Analysis Toolpak
    • File -> Options -> Add-ins -> Manage: Excel Add-ins -> Go

and use the function EDATE(reference_cell, offset_integer), here's an example:

  • A2 = 2/23/2013
  • A3 = EDATE($A1, 1) -> 3/23/2013

EDIT:

As barry houdini pointed out in comment, Analysis Toolpak is needed only for Excel 2003 and earlier, as far as EDATE function is built-in in later versions of Excel.


You have two possible approaches that I can think of. The first is the fill handle:

  1. In cell A1, enter 1/23/2013.
  2. In cell A2, enter 2/23/2013.
  3. Highlight cells A1 and A2.
  4. Place your mouse on the fill handle at the bottom right of the group of highlighted cells, and drag down for as many values as you need.

The second, as discussed already, is formulas, but you need to account for the month of December:

=IF(MONTH($A1) = 12, DATE($A1 + 1, 1, DAY($A1)), DATE(YEAR($A1), MONTH($A1) + 1, DAY($A1)))
  1. If the month is December, compose a new date, DATE(), with the following values:
    1. The original year incremented by 1.
    2. The month of January.
    3. The original day of the month.
  2. Else compose a new date, DATE(), with the following values:
    1. The original year.
    2. The original month incremented by 1.
    3. The original day of the month.

Note that you still need to validate the day of the month. For instance, January 31 is a valid date, but February 31 wouldn't be. That would be a little more complicated, however, and depends on whether you want to cover every edge case.