How do I break a date range by month?

H

HeatherDawn

I am trying to calculated the days in a month for a 14 day pay period. What
I want to do is to calculate how many days are in each month if the pay
period crosses a month. For example the begining date is 8/21/05 and it ends
9/3/05. I was wondering if there is a formula that will allow me to
calculated that there are 3 days in Sept and 11 in August. Thanks
 
B

Bob Phillips

=DATE(YEAR(start),MONTH(start)+1,0)-start+1

and

=end-DATE(YEAR(end),MONTH(end),0)

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
D

Dave O

I mocked up some sample data: pay period start date in column A, end
date in column B. When A2 and B2 are populated, the formula in C2 is
=IF(MONTH(A3)<>MONTH(B3),"Days in " & TEXT(A3,"mmmm") &": " &
EOMONTH(A3,0)-A3+1 & "; Days in " & TEXT(B3,"mmmm") &":
"&B3-EOMONTH(B3,-1),"Days in " & TEXT(A3,"mmmm") &": " & B3-A3+1)

This will determine the number of days in a single month or in both
months when the pay period spans 2 months.
 
Top