Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default Number of days in a specific month between various start and end d

I am looking for a formula that will return the number of days of a
particular month between start and end dates.

For example, if the start and end dates are as follows:

2/23/09 5/6/09
3/12/09 3/28/09
3/2/09 4/16/09

How many days is there in April for each of the three start and end dates?
For the first record, there should be 30 days, for the second, 16 days, and
for the third, 55 days, but what is the formula?
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,389
Default Number of days in a specific month between various start and end d

Assuming the '55 days' in April is a typo, you probably want something like
this:

=MAX(0,MIN(B1,DATE(2009,5,1))-MAX(A1,DATE(2009,4,1)))

It will return zero if the date range doesn't span any days in April, as in
your second example.

Regards,
Fred.


"ibvalentine" wrote in message
...
I am looking for a formula that will return the number of days of a
particular month between start and end dates.

For example, if the start and end dates are as follows:

2/23/09 5/6/09
3/12/09 3/28/09
3/2/09 4/16/09

How many days is there in April for each of the three start and end dates?
For the first record, there should be 30 days, for the second, 16 days,
and
for the third, 55 days, but what is the formula?


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default Number of days in a specific month between various start and e

Correction: Only 16 days for April.

"Don Guillett" wrote:

?? How can April have 55 days. I always thought it was limited to 30 days.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"ibvalentine" wrote in message
...
I am looking for a formula that will return the number of days of a
particular month between start and end dates.

For example, if the start and end dates are as follows:

2/23/09 5/6/09
3/12/09 3/28/09
3/2/09 4/16/09

How many days is there in April for each of the three start and end dates?
For the first record, there should be 30 days, for the second, 16 days,
and
for the third, 55 days, but what is the formula?



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default Number of days in a specific month between various start and e

Thanks Fred!!!!! It works great!!!

"Fred Smith" wrote:

Assuming the '55 days' in April is a typo, you probably want something like
this:

=MAX(0,MIN(B1,DATE(2009,5,1))-MAX(A1,DATE(2009,4,1)))

It will return zero if the date range doesn't span any days in April, as in
your second example.

Regards,
Fred.


"ibvalentine" wrote in message
...
I am looking for a formula that will return the number of days of a
particular month between start and end dates.

For example, if the start and end dates are as follows:

2/23/09 5/6/09
3/12/09 3/28/09
3/2/09 4/16/09

How many days is there in April for each of the three start and end dates?
For the first record, there should be 30 days, for the second, 16 days,
and
for the third, 55 days, but what is the formula?





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default Number of days in a specific month between various start and e

Where i1 is the start date and j1 is the stop date and o1 is a date of the
1st of the month desired. 4/1/2009
Works for all. If you change o1 to 3/1. copy down to get 30,0,16.

=SUMPRODUCT((ROW(INDIRECT(I1&":"&J1))=$O$1)*(ROW( INDIRECT(I1&":"&J1))<DATE(YEAR($O$1),MONTH($O$1)+1 ,1)))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"ibvalentine" wrote in message
...
Correction: Only 16 days for April.

"Don Guillett" wrote:

?? How can April have 55 days. I always thought it was limited to 30
days.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"ibvalentine" wrote in message
...
I am looking for a formula that will return the number of days of a
particular month between start and end dates.

For example, if the start and end dates are as follows:

2/23/09 5/6/09
3/12/09 3/28/09
3/2/09 4/16/09

How many days is there in April for each of the three start and end
dates?
For the first record, there should be 30 days, for the second, 16 days,
and
for the third, 55 days, but what is the formula?




  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,389
Default Number of days in a specific month between various start and e

Glad I could help. Thanks for the feedback.

Regards,
Fred.

"ibvalentine" wrote in message
...
Thanks Fred!!!!! It works great!!!

"Fred Smith" wrote:

Assuming the '55 days' in April is a typo, you probably want something
like
this:

=MAX(0,MIN(B1,DATE(2009,5,1))-MAX(A1,DATE(2009,4,1)))

It will return zero if the date range doesn't span any days in April, as
in
your second example.

Regards,
Fred.


"ibvalentine" wrote in message
...
I am looking for a formula that will return the number of days of a
particular month between start and end dates.

For example, if the start and end dates are as follows:

2/23/09 5/6/09
3/12/09 3/28/09
3/2/09 4/16/09

How many days is there in April for each of the three start and end
dates?
For the first record, there should be 30 days, for the second, 16 days,
and
for the third, 55 days, but what is the formula?




  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default Number of days in a specific month between various start and e

No, I just tested your formula. Fred's formula worked for my particular case,
but does not work throughout the calendar year. Yours works in all cases.

Thanks for the input.

"Don Guillett" wrote:

Did you test with other dates such as 1 jan to 31 dec.

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
how can I calculate number of days based on start and end dates? stumped-in-excel[_2_] Excel Worksheet Functions 2 March 24th 09 07:02 PM
Calculating number of days including the start and end date Terri Excel Discussion (Misc queries) 2 March 2nd 09 01:18 PM
Calculating number of days including the start and end date Shane Devenshire[_2_] Excel Discussion (Misc queries) 0 February 26th 09 10:45 PM
Counting number of days up to an empty cell then start over again SSG QuarterMaster Excel Discussion (Misc queries) 1 May 16th 08 03:28 AM
Number of days in month counted from shortened name of month & yea Tumar Excel Worksheet Functions 6 September 18th 07 03:36 PM


All times are GMT +1. The time now is 05:24 PM.

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

About Us

"It's about Microsoft Excel"