# of Days in Month

  • Thread starter Thread starter Laurie Forbes
  • Start date Start date
L

Laurie Forbes

Hello all:

I have a problem I hope someone can help with. Is there any way or
function to return the number of days in a given month (the specific
month given by the contents of a date formated cell)??

TIA for any assistance.........


Laurie Forbes
 
One way:

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

(for XL, the zeroth day of the month is the last day of the previous
month)
 
Hello all:

I have a problem I hope someone can help with. Is there any way or
function to return the number of days in a given month (the specific
month given by the contents of a date formated cell)??

TIA for any assistance.........


Laurie Forbes


=32-DAY(A1-DAY(A1)+32)

Courtesy of Daniel.M


--ron
 
Laurie Forbes wrote
....Is there any way or function to return the number of days in a
given month (the specific month given by the contents of a date
formated cell)??

If your date is in cell A1 then try this formula:
=IF(MONTH(A1)=12,("01/01/"&(YEAR(A1)+1))-(MONTH(A1)&"/01/"&YEAR(A1)),((MONTH(A1)+1)&"/01/"&YEAR(A1))-(MONTH(A1)&"/01/"&YEAR(A1)))

You can cut and paste the formula from this posting. It gives you a
number - for example, if cell A1 contains 12/3/2003 then the formula
returns 31.
 
=32-DAY(A1-DAY(A1)+32)

Courtesy of Daniel.M

Thanks Ron - that's the best (shortest and handles leap years) so far
(even if I can't figure out how it works :)).


Laurie Forbes
 
On 2 Dec 2003 11:02:14 -0800, (e-mail address removed) (2rrs) wrote:

This is the best yet IMO - it takes the place of honour in my
spreadsheet (:>). Thanks much.
with your date in A1
=DAY(EOMONTH(A1,0))


Laurie Forbes
 
FYI, it needs the ATP add-in, if you send a worksheet to someone who has not
installed ATP they'll get
a name error
 
FYI, it needs the ATP add-in, if you send a worksheet to someone who has not
installed ATP they'll get
a name error

--

Regards,

Peo Sjoblom

Yes - I discovered that when I first tried it. It won't be a problem
however as the worksheet will not be sent to others.

Laurie Forbes
 
Back
Top