How do I calculate the days between dates using DATEDIF

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am finding it difficullt to work with the DATEDIF function. Can anyone
please give a hand?

=DATEDIF("2004/01/22","2004/06/10","MD")
The function returns 19 days which is incorrect. Can anyone perhaps see what
I am doing wrong?

How do I change the dates in the function to reference a cell? e.g A1? As
soon as I do that the function gives me a #value! error.

Is there perhaps a better solution to this functions? I would like to
calculate all the weekdays between to dates.

Thanks
 
What is wrong with 19? Or did you want the days without the months taken
off?

=DATEDIF(A1,A2,"M")

=DATEDIF(A1,A2,"MD")

=DATEDIF(A1.A2,"D")

All work for me assuming you have dates and not text that looks like dates,
make the cell wider, if the data is left aligned without you formatting it
that way it is text, if correct and numeric a date entry it should be right
aligned

To test, add 4 months to 01/22/04, gives 05/22/04,
then put 05822/04 in A1 and 06/10/04 in A2, then do a simple

=A2-A1 and format as general returns 19

Regards,

Peo Sjoblom
 
As long as your short regional data is yyyy/mm/dd or
better for ISO conformance yyyy-mm-dd the
following will return 140
=DATEDIF("2004/01/22","2004/06/10","D")

For more information on DATEDIF see Chip Pearson's page
http://www.cpearson.com/excel/datedif.htm

What you had was difference between 2004-01-22 and 2004-02-11
is 31-22 or 9 add the number of days into the last month which is 10.

MD is month days (days within a month)

HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm
 
overtyped fat fingers mistakes, should have read

=DATEDIF("2004/01/22","2004/06/10","D")
What you had was difference between 2004-01-22 and 2004-01-31
is 31-22 or 9 add the number of days into the last month which is 10.
 
Back
Top