=DATEDIF(start date,end date, unit)

G

gvm

When I use this function, the error #NAME? is returned. Could this because
the function requires an ADD-IN or extra components installed?

DATEDIF is described in my version of HELP but I notice it is not shown in
the list of functions that appears when I select "Paste Function" from the
toolbar and select the category "Date&Time". This is why I think perhaps the
problem is that support is not installed.

I'm using Excel 2000 V9.0.2720
 
P

Peo Sjoblom

It's not an add-inn, I suspect the OP didn't enclose the "y", "ym" etc with
quotations

the unit has to have quotations around it
 
G

Gord Dibben

gvm

DATEDIF was described only in Excel 2000 but is available in many versions of
Excel, including 2000.

You do not need any add-ins, should work with normal setup.


=DATEDIF(A1,NOW(),"y") & " years, " & DATEDIF(A1,NOW(),"ym") & " months, " &
DATEDIF(A1,NOW(),"md") & " days"

The above formula will return a string like 42 years, 9 months, 26 days

A1 holds the earliest date.

For more on DATEDIF see Chip Pearson's site.

http://www.cpearson.com/excel/datedif.htm

There are some caveats with DATEDIF.

From a posting by John McGimpsey.........................

However, be very careful about days - DATEDIF() assumes that a month is
as long as the number of days in the first date's month, so if

A1 = 31 January 1980

on 1 March 2005, the result will be:

Age is 25 Years, 1 Months and -2 Days

Some people may not feel -2 days is valid.

Gord Dibben Excel MVP
 
G

gvm

Thanks everyone, that solved it!
Gord Dibben said:
gvm

DATEDIF was described only in Excel 2000 but is available in many versions of
Excel, including 2000.

You do not need any add-ins, should work with normal setup.


=DATEDIF(A1,NOW(),"y") & " years, " & DATEDIF(A1,NOW(),"ym") & " months, " &
DATEDIF(A1,NOW(),"md") & " days"

The above formula will return a string like 42 years, 9 months, 26 days

A1 holds the earliest date.

For more on DATEDIF see Chip Pearson's site.

http://www.cpearson.com/excel/datedif.htm

There are some caveats with DATEDIF.

From a posting by John McGimpsey.........................

However, be very careful about days - DATEDIF() assumes that a month is
as long as the number of days in the first date's month, so if

A1 = 31 January 1980

on 1 March 2005, the result will be:

Age is 25 Years, 1 Months and -2 Days

Some people may not feel -2 days is valid.

Gord Dibben Excel MVP
 
Top