XL: Formulas that Return the Last or First Day of a Month

Last reviewed: February 2, 1998
Article ID: Q94662

The information in this article applies to:
  • Microsoft Excel 98 Macintosh Edition
  • Microsoft Excel 97 for Windows
  • Microsoft Excel for Windows 95, versions 7.0, 7.0a
  • Microsoft Excel for the Macintosh, versions 2.2, 3.0, 4.0, 5.0, 5.0a
  • Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0a, 5.0, 5.0c
  • Microsoft Excel for OS/2, versions 2.x and 3.0

SUMMARY

To create a formula that returns the last or first day of the current month, follow the appropriate procedure below.

MORE INFORMATION

Microsoft Excel Version 4.0 or Later

In Microsoft Excel 4.0 or later, you can use the EOMONTH function to return the last day of the current month. For example, the following formula

   =EOMONTH(TODAY(),0)

returns the last day of the current month. Because the second argument(the MONTHS argument) is 0 (zero), the function assumes that the month you want to use is the current month. If the second argument is one (1), the function will return the last day of the following month.

To find the first day of the following month, use the EOMONTH function as follows:

   =EOMONTH(TODAY(),0)+1

Microsoft Excel Version 3.0 or Earlier

To return the last day of the current month, use the following formula:

   =DATE(YEAR(NOW()),MONTH(NOW())+1,1)-1

To find the first day of the following month, use the following formula:

   =DATE(YEAR(NOW()),MONTH(NOW())+1,1)

For more information about the EOMONTH function, see pages 133-134 of the version 4.0 "Microsoft Excel Function Reference."

REFERENCES

"Microsoft Excel Function Reference," version 4.0, pages 133-134

"Microsoft Excel Function Reference," version 3.0, pages 44-45, 161 and 251-252

"Microsoft Excel Functions and Macros," version 2.2 for the Macintosh, pages 31-32, 33-34, 66-67

"Microsoft Excel Functions and Macros," version 2.0 for Windows, pages 39-41, 91-92, and 126-127


Additional query words: 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0 3.00
4.0 4.00 5.00 5.00a 5.00c 7.00 7.00a 97 98 XL98 XL97 XL7 XL5 XL4 XL3
Keywords : xlformula
Version : WINDOWS:2.0,3.0,4.0,5.0,5.0c,7.0,7.0a,97; MACINTOSH:2.2,3.0,4.0,5.0,98; os/2:2.0,3.0
Platform : MACINTOSH OS/2 WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.