Subracting Dates to come up with the # of days between them

K

KimberlyC

Hi

I have a "From" Date in Col C and and "To" Date in Col D.
In Col E, I have entred the following formula to calc. the number of days
between them =DATEDIF(C10,D10,"D")
( I'm trying to find the number of days each employee worked for the year
( weekends do not matter..they are supposed to be included in this total
number))

If I have (for ex) 11/1/2004 in C10 and 12/1/2004 in D10, the answer I get
in E10 = 30.
The days should be 31 ( 30 days in Nov and 1 day in Dec).

Is there a different formula I should be using to get the correct days I'm
looking for.....


Thanks in advance for your help!!
Kimberly :)
 
P

Peo Sjoblom

Not that it makes any difference but since you want to count days you might
as well use

=D10-C10 format as general

and since you want to add one day use

=D10-C10+1

Regards,

Peo Sjoblom
 
K

KimberlyC

Hi,
Thanks...
This works, but when I have 1/1/2004 to 12/31/2004...the days are coming up
to 366 instead of 365
But the 11/1/2004 to 12/1/2004 comes up with 31 days..which is correct.
It appears the formula works correctly for the month to month dates...(like
11/1/2004 to 12/30/2004)...but it adds one to many days on the calendar year
dates
such as 1/1/2004 to 12/31/2004.
If I enter 4/1/2004 to 3/31/2005... I come up with 365.. so it appears it
only happens when it's the cal. year.???

Not sure how to resolve that one..
Any advise would be greatly appreicated.
 
G

Gord Dibben

Kimberly

Are you forgetting that 2004 is a Leap Year and has 29 days in February?

Gord Dibben Excel MVP
 
P

Peo Sjoblom

Use

=MAX(B1-A1+1,365)

Regards,

Peo Sjoblom

KimberlyC said:
Hi,
Thanks...
This works, but when I have 1/1/2004 to 12/31/2004...the days are coming up
to 366 instead of 365
But the 11/1/2004 to 12/1/2004 comes up with 31 days..which is correct.
It appears the formula works correctly for the month to month dates...(like
11/1/2004 to 12/30/2004)...but it adds one to many days on the calendar year
dates
such as 1/1/2004 to 12/31/2004.
If I enter 4/1/2004 to 3/31/2005... I come up with 365.. so it appears it
only happens when it's the cal. year.???

Not sure how to resolve that one..
Any advise would be greatly appreicated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top