Calculate Number of Days in a Month

G

Gary T

Hi

I want to be able to use a formula to calculate the number of days in a
month based on a date in question - e.g.

in A1 I enter a date (e.g. 21 November 2007)

in A2 I want to put a formula that will tell me, based on what I have
entered into A1, how many days that month has (e.g. based on what I put in A1
- 21 November 2007, the formula would return 30).

I also need this to account for leap years.

Regards
 
D

Dave Peterson

Or just:
=DAY(DATE(YEAR(A1),MONTH(A1)+1,0))

The zeroth day of the month is the last day of the previous month.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top