Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Automatically Advancing by a Month.

# Automatically Advancing by a Month

Written by Allen Wyatt (last updated July 6, 2019)
This tip applies to Excel 97, 2000, 2002, and 2003

Jim has a need to advance the date in a particular cell by one month at midnight on the 14/15 of each month (00:00:00 on the 15th), and he wondered how it could be done.

As with many problems in Excel, the answer depends on the nature of the data involved and exactly what you want to do. If the date in the cell is today's date, and you simply want to have the cell display the current month up through the 14th, and then next month after that, then you can use a formula such as the following:

```=CHOOSE(IF(DAY(NOW())>14,MONTH(NOW())+1,MONTH(NOW())),
"January","February","March","April","May","June",
"July","August","September","October","November",
"December","January")
```

This formula returns the name of a month, not a date. If you prefer to have a date returned, you can use this formula:

```=IF(DAY(NOW())>14,DATEVALUE(IF(MONTH(NOW())=12,1,
MONTH(NOW())+1) & "/" & DAY(NOW()) & "/" & IF(MONTH(
NOW())=12,YEAR(NOW())+1,YEAR(NOW()))),NOW())
```

Both of these formulas account for the "end of year wrap-around" when you advance from December to January. A shorter version of this last formula can be created if you use the DATE function instead of the DATEVALUE function:

```=DATE(YEAR(NOW()),MONTH(NOW())+((DAY(NOW())>14)*1),1)
```

This formula, unlike the DATEVALUE example, always returns a date that is the first day of any given month.

If you really want to advance the value of a particular date in a cell, then you must use a macro to do the task. Further, you must make sure that the macro only runs once a month, at a particular time on a particular day. For instance, if you wanted the macro to run at 00:00:00 on the 15th of each month, you would need to set up the macro so that it checked the date and time, and then ran at that particular date and time. You would also need to make sure that the workbook containing the macro was open over that date and time.

The following macro will fetch the date from a cell and increase it by a month. The macro assumes that you have a named range, DateCell, which refers to the cell to be updated.

```Sub IncreaseMonth()
Dim dDate As Date
dDate = Range("DateCell").Value
Range("DateCell").Value = _
DateSerial(Year(dDate), _
Month(dDate) + 1, Day(dDate))
End Sub
```

To make sure that the macro runs at the appropriate time, you would need another macro. The following macro is designed to be run whenever the workbook is opened:

```Private Sub Workbook_Open()
If Day(Now) = 14 Then
Application.OnTime ("23:59:59"), "IncreaseMonth"
End If
End Sub
```

Notice that this particular macro sets the OnTime method so that it runs the IncreaseMonth macro at 23:59:59 on the 14th. This date and time was chosen because it is easier to catch than is 00:00:00 on the 15th.

Remember that the IncreaseMonth macro will only run if you open the workbook on the 14th, and then leave the workbook open until the 15th.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2180) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Automatically Advancing by a Month.

##### Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

##### MORE FROM ALLEN

Using Dot Leaders in Special Tables

Adding dot leaders before page numbers in a table of contents or table of authorities can make the finished table look ...

Discover More

Making All Occurrences Bold

Want to make instances of a given word or phrase bold throughout a worksheet? Here's a way you can make the change quickly.

Discover More

Formatting Partial Results of a Search

The Find and Replace capabilities of Word are, simply, quite astounding. This is particularly true when using wildcard ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

##### More ExcelTips (menu)

Using the EOMONTH Function

If you need to determine the date of the last day in a month, it's hard to beat the flexibility of the EOMONTH function. ...

Discover More

The EDATE Function

Want to figure a date a certain number of months in the future or past? The EDATE function may be just what you need for ...

Discover More

There are calendar days and then there are business days. Excel provides the NETWORKDAYS function that is helpful to ...

Discover More
##### Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. Youâ€™ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 8 - 5?

2019-07-07 05:59:08

Willy Vanhaelen

@Frederick Rothstein
Even Shorter by using shortcut notation:

Sub IncreaseMonth()
[DateCell] = DateAdd("m", 1, [DateCell])
End Sub

2019-07-06 11:02:02

Frederick Rothstein

Here are shorter formulas that return the same results as your first two formulas above...

As a Month Name
--------------------------------
=TEXT(EOMONTH(NOW(),0+(DAY(NOW())>14)),"mmmm")

As a Date
---------------------------------
=EOMONTH(NOW(),(DAY(NOW())>14)-1)+1

2019-07-06 05:40:13

Frederick Rothstein

There is a much more compact subroutine available for your IncreaseMonth subroutine...

Sub IncreaseMonth()
Range("DateCell") = DateAdd("m", 1, Range("DateCell"))
End Sub

##### This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.