Date Function

M

MARK XU

Is there an easy way to compute the number of days in a certain month between a starting and ending date? For example, how should I compute the total number of days in March between two given dates?
 
P

Peo Sjoblom

=A2-A1

with starting date in A1 and end date in A2, note that you need to format result as general or else you'll get what looks like a date as an answer


--

Regards,

Peo Sjoblom

"MARK XU" <wmxuATemail.uophx.edu> wrote in message Is there an easy way to compute the number of days in a certain month between a starting and ending date? For example, how should I compute the total number of days in March between two given dates?
 
R

Ron Rosenfeld

Is there an easy way to compute the number of days in a certain month between a starting and ending date? For example, how should I compute the total number of days in March between two given dates?

If I understand your question, you are given a Start Date and an End Date, and
want to know how many of the days between those dates are within a specified
month.

For example, if Start Date = 20 Feb 2006; End Date = 15 Mar 2006 and the month
of interest is March 2006, you would want to return a result of 15.

Adopting the convention of not counting Day 1 as a day "between", then enter
the first day of the month of interest into some cell NAME'd "Month" e.g. 1 Mar
2006, and try this formula:

=MAX(0,MIN(EndDate,Month+32-DAY(Month+32))-
MAX(StartDate,Month)+(StartDate<Month))

Is this what you want?


--ron
 
Top