Days in a month

S

Sena

Hi there,

Am looking a formulae that would return the number of days for a given month.

eg :
A1 = 1/1/07 ( meaning Jan )
A2 = need the number of days in Jan (result - 31)

B1 = 1/11/07 ( meaning Nov )
B2 = need the number of days in Nov (result -30)

Thanks
 
T

T. Valko

Try one of these:

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

If you have the Analysis ToolPak add-in installed:

=DAY(EOMONTH(A1,0))

If the date you enter is *always* the 1st of the month:

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

Rick Rothstein \(MVP - VB\)

Here is one way to get the value...

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

Rick
 
R

Rick Rothstein \(MVP - VB\)

Ignore mine... the first 0 should have been YEAR(A1) as the others have
posted.

Rick
 
T

T. Valko

You need the year otherwise it'll always calculate based on Excel's
interpretation that 1900 was a leap year.

A1 = 2/1/2008

=29

A1 = 2/1/2007

=29
 
R

Rick Rothstein \(MVP - VB\)

Yep... as I am sure you have seen by now, my second posting and yours
crossed in transit.

Rick
 
R

Ron Rosenfeld

Hi there,

Am looking a formulae that would return the number of days for a given month.

eg :
A1 = 1/1/07 ( meaning Jan )
A2 = need the number of days in Jan (result - 31)

B1 = 1/11/07 ( meaning Nov )
B2 = need the number of days in Nov (result -30)

Thanks

If you have the Analysis Tool Pak installed, or are using Excel 2007, you can
try:

=DAY(EOMONTH(A1,0))


--ron
 

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