@ > Home > Contents > Workaround for the DATEDIF function Excel 97+

DATEDIF is important to get time units. It is supported by all Excel releases for the PC though not documented after xl2000.:

DATEDIF("2001/1/1","2003/1/1","Y") returns 2 (two full years).
DATEDIF("2001/6/1","2002/8/15","D") returns 440 days.
DATEDIF("2001/6/1","2002/8/15","YD") returns 75 days without full years (kind of "Difference MOD years").
DATEDIF("2001/6/1","2002/8/15","MD") returns 14 days without full months.

Attention: DATEDIF is not supported by Pocket Excel and Open Office, explaining the title!

- A1 and B1 are integers (meaning: dates with time=0:00). If not, you have to make them to! 
- B1 is not allowed to be earlier than A1.


can be used crossover (based upon an idea of Klaus Blaschke, similar to 5014.htm) as =YEAR(B1)-YEAR(A1)-(MONTH(B1)+DAY(B1)%<MONTH(A1)+DAY(A1)%)

Open Office uses its own formula as direct alternative:


is rather simple (1 day equals 1 - the unit has a fix length):

(Other DATEDIFs will follow)