The information in this article applies to:
SUMMARY
In Microsoft Excel, you can use the date functions to calculate the number
of days in a month. For example, you can use the following formula to
return the number of days in a month based on a given starting date
where The_Date is the starting date. This formula works by finding the "zeroth" day of the month after The_Date. Because there is no "zeroth" day of any month, this date is interpreted as the last day of the month containing The_Date. The DAY function then converts this date into a day number. Or, to calculate the number of days in a month given the month and year, use the following function
where my_month is the month for which you want to return the number of days, and my_year is the year. This function calculates the first day of the next month and subtracts 1, which equals the last day of the current month. The DAY function then gives you the day of the month. MORE INFORMATIONMicrosoft Excel Versions 5.0 and LaterMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:http://www.microsoft.com/support/supportnet/overview/overview.asp In Microsoft Excel versions 5.0 and later, use the following Visual Basic for Applications procedure:
REFERENCES"Function Reference" version 3.0, pages 44, 46, 156, 251 Additional query words: 5.00a 5.00c 7.00a 97 98 XL98 XL97 XL7 XL5 XL4 XL3
Keywords : xlformula |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |