Difference between Dates doesnt work

  • Thread starter Thread starter sachinattri
  • Start date Start date
S

sachinattri

I am trying to find out the difference between two dates. I want it i
number of years, they are all actually between 1 to 5 years only.

Do I need to keep the dates in a particular format? I have
26-May-2004 format.

However, i have changed that too and used
26/05/2004

and used *=DATEDIF(B2;C2;"y")* function but it still doesnt work.

I am using WinNT 97.

Please help.

Thank yo
 
Hi!

You might try =YEAR(A2)-YEAR(A1) formatted as a number with 0 d.p.

A1 and A2 hold dates.

Al
 
Hi!!

Sorry!

0 d.p. is an abbreviation of zero decimal places. In other words,
whole number or integer.

Al
 
The delimiter used within Excel functions should be a
comma, not a semicolon as is used in your example.

Try something like "=DATEDIF(B2,C2,"y")"

By the way, the date format should not matter as long as
the data is recognized as a valid date. The date values
are actually just numeric counts of days starting with
1/1/1900 (this is 1/2/1904 in Mac versions). Time within
each day is the decimal equivalent of 24 hours.

HTH,

TK
 
I am trying to find out the difference between two dates. I want it in
number of years, they are all actually between 1 to 5 years only.

Do I need to keep the dates in a particular format? I have
26-May-2004 format.

No, but the date has to be recognized by Excel as a date. A common mistake is
that the date is really text and not a number. You can test for this by a
formula of the type =ISTEXT(A1). Substitute for A1 the cell reference of your
date. If the formula returns TRUE, your date is TEXT and not a true excel
date.
and used *=DATEDIF(B2;C2;"y")* function but it still doesnt work.

What, exactly, happens when it "doesn't work"?

--ron
 
You're using semicolons for your list separator.

If you're not using an English language version of excel, maybe it's a language
difference.

If this is true, try this against a test workbook:

hit alt-f11 (to get to the VBE)
hit ctrl-g (to see the immediate window)

type this and hit enter:

Range("a1").Formula = "=datedif(b2,c2,""Y"")"

alt-f11 to get back to excel and look at your formula.
 

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

Back
Top