Date difference = zero?

G

Guest

I'm using this function to calculate date difference, but just stumbled upon
something that's making me think it's wrong.

Here it is: =DATEDIF(B3,C3,"y") & " years, " & DATEDIF(B3,C3,"ym") & "
months, " & DATEDIF(B3,C3,"md") & " days"

It seemed to work fine until I entered the same date into the two cells, and
what returned was: 0 years, 0 months, 0 days. This seems odd to me. Shouldn't
that be 0 years, 0 months, 1 days. Why doesn't the function count the "zero
date" as one? How should I modify it so I get an accurate result?

Thanks
 
N

Nick Hodge

Surely the date difference between two dates which are the same IS zero.
There are no dates different. What would two dates 1 day apart show? 2? Not
sure I follow you

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England

(e-mail address removed)
www.nickhodge.co.uk
 
G

Guest

Surely the date difference between two dates which are the same IS zero.
There are no dates different. What would two dates 1 day apart show? 2? Not
sure I follow you

Logically, yes. But not in my case, because I need this formula to deternime
how long a person has been a client. If they came in only once, and never
again, they were our client for one day. Not zero days. You see?
 
D

Dave Peterson

Maybe you could just add 1 to each C3:

=DATEDIF(B3,C3+1,"y") & " years, "
& DATEDIF(B3,C3+1,"ym") & "months, "
& DATEDIF(B3,C3+1,"md") & " days"
 
N

Nick Hodge

Or Dave...?

IF(B3=C3,1,DATEDIF(OrigFormulahere))

If a time is involved you could use DATEVALUE around each B3,C3. Obviously
the 1 could be expanded to a string to match 'look' of DATEDIFs return 'x
years x months x years'

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England

(e-mail address removed)
www.nickhodge.co.uk
 
D

Dave Peterson

If starting on Oct 19, 2006 and finishing Oct 19, 2006 meant that it should
count as 1 day, then I figured starting on Oct 19, 2006 and finishing on Oct 20,
2006 should count as 2 days.

But who knows if that matches the OP's requirements??
 

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