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
If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:
Microsoft Certified Partners - https://partner.microsoft.com/global/30000104
Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMSIn Microsoft Excel, you can also use the following Visual Basic for Applications procedure:
Dim m As Integer, y As Integer, DaysInMonth As Integer
' define variable for number of the month, in this example, November
m = 11
' define variable for the year
y = 1994
DaysInMonth = DateSerial(y, m + 1, 1) - DateSerial(y, m, 1)
Help menu, type about using functions to calculate values in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.
ID d'article : 214313 - Dernière mise à jour : 13 juil. 2009 - Révision : 1