Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: End-of-Month Calculations.

End-of-Month Calculations

Written by Allen Wyatt (last updated July 29, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


There are many ways you can use Excel to calculate the date at the end of the next month. One such way, using the EOMONTH function, is described in other ExcelTips. There are ways you can do it, however, without using that particular function. (Some may not want to use it because the EOMONTH function used to only be available if the Analysis Toolpak was loaded. If you couldn't count on it being loaded, it doesn't make sense to rely on the function.)

For instance, one approach is to AutoFill for the last days. Let's say you wanted the last days of a series of months in the first column, beginning at A4. All you need to do is this:

  1. In cell A4, enter the last day of the current month, such as 31 Jul 2023.
  2. In cell A5, enter the last day of next month, such as 31 Aug 2023.
  3. Select both cells, A4 and A5.
  4. Click on the small square handle at the bottom right corner of the selection.
  5. Drag the mouse downward as many cells as desired.

The result is that the area you drag over in step 5 is filled with end-of-month dates for the next however many months. Pretty cool! A slight variation on these steps could also be used:

  1. In cell A4, enter the last day of the current month, such as 31 Jul 2023.
  2. Select cell A4.
  3. Right-click on the small square handle at the bottom right corner of the selection.
  4. Drag the mouse downward as many cells as desired. When you release the mouse button, Excel displays a Context menu.
  5. From the Context menu, choose Fill Months.

If you are not an AutoFill type of person, and instead prefer to use formulas, you could enter the starting end-of-month date in cell A4 (it must be an actual end-of-month date) and then the following formula in A5:

=DATE(YEAR(A4),MONTH(A4)+2,1)-1

This formula calculates the date for the first day of the month two months in the future, and then subtracts one from it. The result is the last day of the next month. The formula wraps around the end of years just fine, since the DATE function increments the years properly if the month value provided is greater than 12.

Another formulaic approach is to use the following:

=A4+32-DAY(A4+32)

This formula works because it adds 32 to the starting date (to make sure you are past the end of the following month), and then subtracts the number of days the result is past the end of the month.

If you want to try another handy way to utilize the DATE function for figuring out a month end, take a look at this example:

=DATE(2023,8,0)

This will return a date of July 31, 2023. Note that for the month in the DATE function (the second parameter) you use the number of the month following the one you want, and you specify a day number of 0 as the third parameter. Since the 0 is one less than the first day (1) of the month specified, then DATE returns the last day of the previous month.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12323) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: End-of-Month Calculations.

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

Maintaining Leading Zeroes

When merging ZIP Codes from a data source such as Excel, you might find that Word ends up dropping out leading zeroes in ...

Discover More

Detecting if the Insertion Point is Inside a Bookmark

When processing a document using a macro, you may need to know if the insertion point is within a bookmark or not. This ...

Discover More

Accessing Footnote Text in a Macro

Using macros you can access just about anything in a Word document. Accessing the text within footnotes is no exception, ...

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 (ribbon)

Returning Nothing If Two Values are Empty

Excel includes a large number of functions that can be used in evaluating the data in a worksheet. In this tip you learn ...

Discover More

Changing How Excel Determines which Year to Use

When you enter a date into a cell and you omit the year, Excel helpfully adds the current year to the date. If you want ...

Discover More

Calculating a Sum for a Range of Dates

If you use Excel to track information based on dates, you may wonder how to get a sum for only certain dates that you ...

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

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 + 7?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

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

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.