Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Calc Days in Month

Status
Not open for further replies.

sinyce

IS-IT--Management
May 27, 2002
57
0
0
US
Is there a way to calculate the number of days in any month?

Like a canned formula? I've looked thru all none seems to return the days of month, eg

=DAYSOFMONTH(MONTH())=30

(of course DAYSOFMONTH is not real)
 
Hi
There are proably quite a few ways of doing this but I use a function called EOMONTH.
This returns the last date of a given month.

Note that the function is in the analysis toolpak addin, therefore this needs to be loaded/referenced for the function to become available.

To install it go TOOLS>ADD INS and check the toolpak. I'd also check the VBA toolpak for goodmeasure and incase you may need it in future.

As an example, if you have a date in cell B1 this formula will return the number of days in the month for that date
=DAY(EOMONTH(B1,0))

Enjoy!
;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
The faqs ma'am, just the faqs. Get the best from these forums : faq222-2244
 
this is the formula that I came up with, a little longer than Loomah's
=DAY(DATE(YEAR(NOW()),MONTH(NOW())+1,1)-1)

Regards,

Wray
 
Excellent!! Both of these work.

Thanks for the quick response.

sinyce

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top