
Tips.Net > ExcelTips Home > Worksheet Functions > Date and Time Functions > Using the EOMONTH Function
Summary: The EOMONTH function returns the last day of a month you specify, either in the future or in the past. The function is easy to use and can be very helpful when working with dates. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, and Excel 2003.)
The EOMONTH function is used to return the serial number value for the last day of any particular month, past, present, or future. The syntax for the function is as follows:
=EOMONTH(base, offset)
The base value is a date from which the function should do its calculations, and the offset is a number that indicates how many months from the base date should be used. For instance, an offset of 0 would indicate that EOMONTH should return the last day of the month represented in base, whereas an offset of 4 would be four months after base, and -2 would be two months before.
As an example, the following are typical uses of EOMONTH. The first line can be used to return the last day of the current month, and the second line returns the last day of the month six months later than the date in A1:
=EMONTH(NOW(),0) =EMONTH(A1,6)
Remember that EOMONTH returns a serial number. Excel does not automatically format the serial number as a date. In other words, you will need to explicitly format the cell as a date. (Just select Cells from the Format menu and you can do all the formatting you want.)
The EOMONTH function is a part of the Analysis Toolpak. If you get an error when you try to use the function, you can make sure the toolpak is loaded in this manner:
Tip #2810 applies to Microsoft Excel versions: 97 2000 2002 2003
More Power! Expand your skills and make Excel really sing! It's all possible with macros. The best resource anywhere for macros is ExcelTips: The Macros. Check it out today!
PivotTables don't need to be scary or mysterious. Use this powerful tool to analyze your data in ways you didn't know were possible. (more information...)
Ask an Excel Question
Make a Comment
ExcelTips FAQ
ExcelTips Premium
Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips
Advertise on the
ExcelTips Site