Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Ryan Proudfit
 
Posts: n/a
Default number of days in a month

I need a function or formula that will return the number of days in a month.
I saw it in one of my reference books, but I'll probably never find it again.
Please help.

--
Ryan Proudfit
  #2   Report Post  
Duke Carey
 
Posts: n/a
Default

=DAYS(EOMONTH( target date,0))

to use EOMONTH() you must have the Analysis toolpack add-in loaded

To get the same answer without the Analysis toolpack

=DAY(Date(year(target date), month( target date)+1, 1)-1)

Duke

"Ryan Proudfit" wrote:

I need a function or formula that will return the number of days in a month.
I saw it in one of my reference books, but I'll probably never find it again.
Please help.

--
Ryan Proudfit

  #3   Report Post  
Arvi Laanemets
 
Posts: n/a
Default

Hi


"Duke Carey" wrote in message
...
=DAYS(EOMONTH( target date,0))

to use EOMONTH() you must have the Analysis toolpack add-in loaded

To get the same answer without the Analysis toolpack

=DAY(Date(year(target date), month( target date)+1, 1)-1)


Somewhat shorter version:
=DAY(Date(year(target date), month( target date)+1, 0))


Arvi Laanemets


  #4   Report Post  
Chip Pearson
 
Posts: n/a
Default

Ryan,

The following formula will return the number of days in the
current month.

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

It works because the 0th day of one month is the last day of the
prior month.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com









"Ryan Proudfit" wrote in
message
...
I need a function or formula that will return the number of days
in a month.
I saw it in one of my reference books, but I'll probably never
find it again.
Please help.

--
Ryan Proudfit



  #5   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Thu, 7 Apr 2005 10:17:04 -0700, "Ryan Proudfit"
wrote:

I need a function or formula that will return the number of days in a month.
I saw it in one of my reference books, but I'll probably never find it again.
Please help.



Given any date in a month in A1, the number of days in that month is:

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


--ron


  #6   Report Post  
Ryan Proudfit
 
Posts: n/a
Default

I tried both ways and still get an error. All I'm doing is substituting a
cell reference in the target date portion of the formula. What the heck am I
doing wrong?

Ryan :\

"Duke Carey" wrote:

=DAYS(EOMONTH( target date,0))

to use EOMONTH() you must have the Analysis toolpack add-in loaded

To get the same answer without the Analysis toolpack

=DAY(Date(year(target date), month( target date)+1, 1)-1)

Duke

"Ryan Proudfit" wrote:

I need a function or formula that will return the number of days in a month.
I saw it in one of my reference books, but I'll probably never find it again.
Please help.

--
Ryan Proudfit

  #7   Report Post  
Duke Carey
 
Posts: n/a
Default

That's a new one on me., Arvi. Live and learn (and learn, and learn)

"Arvi Laanemets" wrote:

Hi


"Duke Carey" wrote in message
...
=DAYS(EOMONTH( target date,0))

to use EOMONTH() you must have the Analysis toolpack add-in loaded

To get the same answer without the Analysis toolpack

=DAY(Date(year(target date), month( target date)+1, 1)-1)


Somewhat shorter version:
=DAY(Date(year(target date), month( target date)+1, 0))


Arvi Laanemets



  #8   Report Post  
Arvi Laanemets
 
Posts: n/a
Default

Hi

Are you sure you have a date in cell, not a datestring. When you format the
cell with date as general, does it change to number? When not, then you have
to convert it, or to modify the formula so it works with datestring.


Arvi Laanemets


"Ryan Proudfit" wrote in message
...
I tried both ways and still get an error. All I'm doing is substituting a
cell reference in the target date portion of the formula. What the heck

am I
doing wrong?

Ryan :\

"Duke Carey" wrote:

=DAYS(EOMONTH( target date,0))

to use EOMONTH() you must have the Analysis toolpack add-in loaded

To get the same answer without the Analysis toolpack

=DAY(Date(year(target date), month( target date)+1, 1)-1)

Duke

"Ryan Proudfit" wrote:

I need a function or formula that will return the number of days in a

month.
I saw it in one of my reference books, but I'll probably never find it

again.
Please help.

--
Ryan Proudfit



  #9   Report Post  
Sandy Mann
 
Posts: n/a
Default

"Arvi Laanemets" wrote in message
...

Somewhat shorter version:
=DAY(Date(year(target date), month( target date)+1, 0))


and if you can guarantee that target date will never be later than the 28th
then

=DAY(A14+32-DAY(A14+32))

is shorter still, otherwise

=DAY(A14-DAY(A14)+32-DAY(A14-DAY(A14)+32))

Sandy

--
to e-mail direct replace @mailinator.com with @tiscali.co.uk



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP - need to returns the current number of past month this year and ... elz64 Excel Worksheet Functions 6 April 6th 05 01:37 PM
how do i display the total number of days in the current month in. timerigger Excel Discussion (Misc queries) 6 March 20th 05 05:13 PM
Calculating the number of Fridays in a month Greg Ward Excel Worksheet Functions 5 March 2nd 05 05:47 PM
Count number of days in given month? Bryan Excel Worksheet Functions 10 February 2nd 05 11:44 PM
How to extract month number from month name PM Excel Discussion (Misc queries) 2 January 19th 05 03:07 PM


All times are GMT +1. The time now is 05:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"