XL: Formulas that Return the Last or First Day of a Month
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.20 2.21 3.0 5.00a 5.00c 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
Issue type :
Last Reviewed: March 31, 1999