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

by Allen Wyatt
(last updated March 13, 2015)

7

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.

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

Choosing an Insert Method for Pictures

The way that you choose to add pictures to your document can have an effect on the file size of those documents. It is best ...

Discover More

Configuring Spell Check for Internet Addresses

When writing technical documents, URLs are a common thing to include in your text. Normally Word will mark these as ...

Discover More

Copying Paragraph Formatting with the Mouse

When you get one paragraph formatted just the way you want, you might want to copy that formatting so it can be applied to a ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

MORE EXCELTIPS (MENU)

Working with Elapsed Time

Work with times in a worksheet and you will eventually want to start working with elapsed times. Here's an explanation of ...

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 your ...

Discover More

Elapsed Days as Years, Months and Days

Need to know how many days there are between two dates? It's easy to figure out—unless you need the figure in years, ...

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.

Comments for this tip:

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}] in your comment text. You’ll be prompted to upload your image when you submit the comment. 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 7 + 8?

2017-03-03 11:09:16

Patrick Brethen

How would I do this if want to advance a date once a year?

I track age changes of employees based on an anniversary. So for example, I need to list employee ages as of 9/1 each year. How do I automate this so when I open the workbook it auto-populates the age as of the most recent 9/1 anniversary?

thanks!


2016-09-17 13:52:01

Ohisio John

Dear Allen Wyatt,

I used this function between Months. e.g from September to October. The function works well. This is how I did it but when the system, I meant when entering into a new Month, it showed me From October To October (the same Month). It does not show me From October To November. What could the error ?.

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

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

Please help.


2015-11-05 00:01:22

Vasile

hello to get the current month I think the bellow formula is more useful and shorter:

=PROPER(TEXT(NOW();"mmmm"))


2014-08-04 14:10:27

Barry

@Chetan

Using the EDATE function incrementing 31-Oct-2013 by 1 month gives 30-Nov-2013, incrementing 31-Oct-2013 by 4 months would give 28-Feb-2104 (and incrementing 31-Oct-2011 by 4 months would give 29-Feb-2012 as 2012 is a leap year).

@SM 10
I don't know idf you've figured this out by now - it's a year since you posted your request. But for anyone else the following function does what you want:

=TEXT(EDATE(A1-21,1),"mmmm") - assuming the date is in cell A1


2014-08-03 09:30:01

Michael (Micky) Avidan

To my opinion (if I correctly understood the task) the best and shortest way will be:
=IF(DAY(NOW())>14,EDATE(NOW(),1),NOW())
*** In the old versions (2000-2007) the EDATE function is part of the Analysis Toolpak Add-In, which comes with Excel, but needs to be activated.
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)
ISRAEL


2014-08-02 18:33:14

chetan

If date is is 31.10.2013 then how you will increase by one month. If you do this it will increase to 1.12.2013


2013-04-26 10:31:10

SM10

I want to do a similar type of formula as above however I want to be able to display a specific month depending on the date.

for example
If the date entered between 22/01/2013 and 21/02/2013 I want to display February.
If the date entered between 22/02/2013 and 21/02/2013 I want to display March.
If the date entered between 22/03/2013 and 21/04/2013 I want to display April.
And so on and so on....

How can I do this using a simple formula?


Newest Tips
Subscribe

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

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.

Links and Sharing
Share