Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 204
Default How many days fall in each month?

I have a date range (say... 12/5/2009 to 27/9/2009) with the two dates in
two cells, say... A1 and A2

and a table where each of my column headings is a month (they're actually
dates representing the 1st of each month, but formatted to just show the
month and year e.g.Sep 09 - although in tructh, I don't really care what
they are)

Anyway I want to have the number of days that fall in that month displayed
under each month name. i.e. if my date range starts on 12/5/2009, May 09
will have 20 below, June 09 will have 30 below, July 09 will have 31 below
etc. until the end of the range when (if my range finishes on 27/9/09) Sep
09 will have 27 below. All other months will have a blank or zero.

In my ideal world this would not be an array formula, because I might need
to delete or edit certain cells/columns, but if that's the only way then so
be it

I've been struggling with this for a while - and I haven't got very far at
all!

I'd be grateful for any ideas

Many, many thanks

M

  #2   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,298
Default How many days fall in each month?


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

the zero'th day of month (n+1) is the last day of month n eg the 0 june is
teh
"Michelle" wrote:

I have a date range (say... 12/5/2009 to 27/9/2009) with the two dates in
two cells, say... A1 and A2

and a table where each of my column headings is a month (they're actually
dates representing the 1st of each month, but formatted to just show the
month and year e.g.Sep 09 - although in tructh, I don't really care what
they are)

Anyway I want to have the number of days that fall in that month displayed
under each month name. i.e. if my date range starts on 12/5/2009, May 09
will have 20 below, June 09 will have 30 below, July 09 will have 31 below
etc. until the end of the range when (if my range finishes on 27/9/09) Sep
09 will have 27 below. All other months will have a blank or zero.

In my ideal world this would not be an array formula, because I might need
to delete or edit certain cells/columns, but if that's the only way then so
be it

I've been struggling with this for a while - and I haven't got very far at
all!

I'd be grateful for any ideas

Many, many thanks

M


  #3   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default How many days fall in each month?

Try this:

1st of the month *dates* starting in B1:

Enter this formula in B2 and copy across as needed:

=MAX(0,MIN(B1+32-DAY(B1+32),$A2)-MAX(B1,$A1)+1)

--
Biff
Microsoft Excel MVP


"Michelle" wrote in message
...
I have a date range (say... 12/5/2009 to 27/9/2009) with the two dates in
two cells, say... A1 and A2

and a table where each of my column headings is a month (they're actually
dates representing the 1st of each month, but formatted to just show the
month and year e.g.Sep 09 - although in tructh, I don't really care what
they are)

Anyway I want to have the number of days that fall in that month displayed
under each month name. i.e. if my date range starts on 12/5/2009, May 09
will have 20 below, June 09 will have 30 below, July 09 will have 31 below
etc. until the end of the range when (if my range finishes on 27/9/09) Sep
09 will have 27 below. All other months will have a blank or zero.

In my ideal world this would not be an array formula, because I might need
to delete or edit certain cells/columns, but if that's the only way then
so be it

I've been struggling with this for a while - and I haven't got very far at
all!

I'd be grateful for any ideas

Many, many thanks

M



  #4   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 204
Default How many days fall in each month?

Thanks - works a treat - I love the help I get in these groups

M


"T. Valko" wrote in message
...
Try this:

1st of the month *dates* starting in B1:

Enter this formula in B2 and copy across as needed:

=MAX(0,MIN(B1+32-DAY(B1+32),$A2)-MAX(B1,$A1)+1)

--
Biff
Microsoft Excel MVP


"Michelle" wrote in message
...
I have a date range (say... 12/5/2009 to 27/9/2009) with the two dates in
two cells, say... A1 and A2

and a table where each of my column headings is a month (they're actually
dates representing the 1st of each month, but formatted to just show the
month and year e.g.Sep 09 - although in tructh, I don't really care what
they are)

Anyway I want to have the number of days that fall in that month
displayed under each month name. i.e. if my date range starts on
12/5/2009, May 09 will have 20 below, June 09 will have 30 below, July 09
will have 31 below etc. until the end of the range when (if my range
finishes on 27/9/09) Sep 09 will have 27 below. All other months will
have a blank or zero.

In my ideal world this would not be an array formula, because I might
need to delete or edit certain cells/columns, but if that's the only way
then so be it

I've been struggling with this for a while - and I haven't got very far
at all!

I'd be grateful for any ideas

Many, many thanks

M




  #5   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default How many days fall in each month?

You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"Michelle" wrote in message
...
Thanks - works a treat - I love the help I get in these groups

M


"T. Valko" wrote in message
...
Try this:

1st of the month *dates* starting in B1:

Enter this formula in B2 and copy across as needed:

=MAX(0,MIN(B1+32-DAY(B1+32),$A2)-MAX(B1,$A1)+1)

--
Biff
Microsoft Excel MVP


"Michelle" wrote in message
...
I have a date range (say... 12/5/2009 to 27/9/2009) with the two dates in
two cells, say... A1 and A2

and a table where each of my column headings is a month (they're
actually dates representing the 1st of each month, but formatted to just
show the month and year e.g.Sep 09 - although in tructh, I don't really
care what they are)

Anyway I want to have the number of days that fall in that month
displayed under each month name. i.e. if my date range starts on
12/5/2009, May 09 will have 20 below, June 09 will have 30 below, July
09 will have 31 below etc. until the end of the range when (if my range
finishes on 27/9/09) Sep 09 will have 27 below. All other months will
have a blank or zero.

In my ideal world this would not be an array formula, because I might
need to delete or edit certain cells/columns, but if that's the only way
then so be it

I've been struggling with this for a while - and I haven't got very far
at all!

I'd be grateful for any ideas

Many, many thanks

M






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
Using DATEDIF how do I add another month of each date fall on same kmt1984 Excel Discussion (Misc queries) 4 May 22nd 09 11:00 PM
excel to make the days cary over month to month automaticly GARY New Users to Excel 1 April 19th 08 06:05 PM
Number of days in month counted from shortened name of month & yea Tumar Excel Worksheet Functions 6 September 18th 07 03:36 PM
if "x" days is more fall on weekend return following monday jermsalerms Excel Worksheet Functions 3 July 7th 06 12:47 AM
how would I count dates (not # of days) in cells that fall betwee. sailingscotts Excel Worksheet Functions 3 August 16th 05 04:29 AM


All times are GMT +1. The time now is 05:02 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"