ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   number of days in a month (https://www.excelbanter.com/excel-worksheet-functions/21016-number-days-month.html)

Ryan Proudfit

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

Duke Carey

=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


Arvi Laanemets

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



Chip Pearson

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




Ron Rosenfeld

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

Ryan Proudfit

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


Duke Carey

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




Arvi Laanemets

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




Sandy Mann

"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





All times are GMT +1. The time now is 02:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com