Excel subtracting dates does not work, see description below

I have two dates for eg. 12/02/2001 and 22/04/2001. I want to get the difference between the two in days. But when I try = A2-A1 is gives me #VALUE! On the other hand, =A1+1 works by adding 1 day. However, I want the difference of the two dates. How do I fix this?

5

3 Answers

It seems that A1 is being interpreted properly as a date but A2 is not. Make sure your locale is set to interpret dates in the European style dd/mm/yy instead of the US mm/dd/yy.

Try

=DATEDIF(Date1, Date2, Interval)

Where:
Date1 is the first date,
Date2 is the second date,
Interval is the interval type to return.

If Date1 is later than Date2, DATEDIF will return a #NUM! error. If either Date1 or Date2 is not a valid date, DATEDIF will return a #VALUE error.

For example

  • Date1: 1-Jan-2007
  • Date2: 10-Jan-2007
  • Interval: d
  • Result: 9

Source

Or, use DATEVALUE()

=DATEVALUE("9/29/2012")-DATEVALUE("9/10/2012")

Source

1

Also check that the data type for your equation is general or numeric. Had similar issues today and changing to "general" fixed everything.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like