Calculating age of death

A

Annie

Hi
I work in a hospital and have to calculate what exact age someone is when
they die. I have birth date and date of death. How can I calculate in total
the age on death. Example, 45 years, 4 months and 5 days

Many thanks
 
M

Mike H

Maybe

=DATEDIF(A1,A2,"y")&" y "&DATEDIF(A1,A2,"ym")&" m "&DATEDIF(A1,A2,"md")&" d"

Where a1= DOB
a2 = DOD

Mike H
 
R

Ron Rosenfeld

Maybe

=DATEDIF(A1,A2,"y")&" y "&DATEDIF(A1,A2,"ym")&" m "&DATEDIF(A1,A2,"md")&" d"

Where a1= DOB
a2 = DOD

Mike H

Since this is in a hospital, and the result probably going on some kind of
legal document, I think you need to have the legal definition of "age" for this
purpose.

Some odd results arise with that formula when it is used for this kind of
determination:

DOB: 31 Jan 1943
DOD: 01 Mar 2008

Your Formula: 65 y 1 m -1 d


--ron
 
R

Rick Rothstein \(MVP - VB\)

Maybe
Since this is in a hospital, and the result probably going on some kind of
legal document, I think you need to have the legal definition of "age" for
this
purpose.

Some odd results arise with that formula when it is used for this kind of
determination:

DOB: 31 Jan 1943
DOD: 01 Mar 2008

Your Formula: 65 y 1 m -1 d

I've always thought measuring a time span using years, months and days is
somewhat useless as the months part is not a very definitive increment. The
number of days spanned by some number of months differs depending on the
months being spanned. Hell, even years can be somewhat problematic give the
occurrence of leap years within time spans; but, when used by itself as a
"rough" indicator of time span, this if fine; however, the accuracy implied
by specifying a time span in years, months and days has always bothered me
(way more so than simply specifying years and days, even though I recognize
the inaccuracy introduced by the leap years here).

Rick
 
N

Niek Otten

<way more so than simply specifying years and days,>

Indeed. Financial (and actuarial, my area of interest) systems often use this. But because product specifications often *do* refer
to months, the 360-day system is somewhat popular in those groups. Not that it's perfect!
It assumes a 360-day year, consisting of 12 30-day months.
As you can imagine, the remaining 5 or 6 days are subject to lots of different interpretations, but AFAIK they boil down to 2
systems; NASD or European (see HELP for DAYS360).

If only customers would specify what "number of months difference" means (to them).....

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


| >>Maybe
| >>
| >>=DATEDIF(A1,A2,"y")&" y "&DATEDIF(A1,A2,"ym")&" m "&DATEDIF(A1,A2,"md")&"
| >>d"
| >>
| >>Where a1= DOB
| >>a2 = DOD
| >
| > Since this is in a hospital, and the result probably going on some kind of
| > legal document, I think you need to have the legal definition of "age" for
| > this
| > purpose.
| >
| > Some odd results arise with that formula when it is used for this kind of
| > determination:
| >
| > DOB: 31 Jan 1943
| > DOD: 01 Mar 2008
| >
| > Your Formula: 65 y 1 m -1 d
|
| I've always thought measuring a time span using years, months and days is
| somewhat useless as the months part is not a very definitive increment. The
| number of days spanned by some number of months differs depending on the
| months being spanned. Hell, even years can be somewhat problematic give the
| occurrence of leap years within time spans; but, when used by itself as a
| "rough" indicator of time span, this if fine; however, the accuracy implied
| by specifying a time span in years, months and days has always bothered me
| (way more so than simply specifying years and days, even though I recognize
| the inaccuracy introduced by the leap years here).
|
| Rick
|
 
R

Ron Rosenfeld

I've always thought measuring a time span using years, months and days is
somewhat useless as the months part is not a very definitive increment. The
number of days spanned by some number of months differs depending on the
months being spanned. Hell, even years can be somewhat problematic give the
occurrence of leap years within time spans; but, when used by itself as a
"rough" indicator of time span, this if fine; however, the accuracy implied
by specifying a time span in years, months and days has always bothered me
(way more so than simply specifying years and days, even though I recognize
the inaccuracy introduced by the leap years here).

Rick

In general I agree with you, but there are certain legal ramifications in
certain areas, and, if clarified, can allow one to express a time span even
with the inclusion of "months".

For example, some kinds of aviation certifications are defined in terms of
"calendar months". The meaning is clear (if you know the definition), but not
something that can be computed (easily) using DATEDIF.
--ron
 
S

Susie Toews

=YEAR(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1900&" Years "&IF(MONTH(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1=0,"",MONTH(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1&" Months ")&IF(DAY(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1=0,"",DAY(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1&" Days")
Hi
I work in a hospital and have to calculate what exact age someone is when
they die. I have birth date and date of death. How can I calculate in total
the age on death. Example, 45 years, 4 months and 5 days

Many thanks


--
Kind regards

Ann Shaw
On Thursday, February 21, 2008 9:30 AM Mike wrote:
Maybe

=DATEDIF(A1,A2,"y")&" y "&DATEDIF(A1,A2,"ym")&" m "&DATEDIF(A1,A2,"md")&" d"

Where a1= DOB
a2 = DOD

Mike H

"Annie" wrote:
[A1] = date of birth;
[B1] = Date of death;

=DATEDIF(A1,B1,"y")&"y,"&DATEDIF(A1,B1,"ym")&"m,"&DATEDIF(A1,B1,"md")&"d"

Should work OK

Regards
Zanny
 
S

Susie Toews

=YEAR(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1900&" Years "&IF(MONTH(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1=0,"",MONTH(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1&" Months ")&IF(DAY(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1=0,"",DAY(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1&" Days")

Deathdate= D8
Birthdate= B8
Hi
I work in a hospital and have to calculate what exact age someone is when
they die. I have birth date and date of death. How can I calculate in total
the age on death. Example, 45 years, 4 months and 5 days

Many thanks


--
Kind regards

Ann Shaw
On Thursday, February 21, 2008 9:30 AM Mike wrote:
Maybe

=DATEDIF(A1,A2,"y")&" y "&DATEDIF(A1,A2,"ym")&" m "&DATEDIF(A1,A2,"md")&" d"

Where a1= DOB
a2 = DOD

Mike H

"Annie" wrote:
[A1] = date of birth;
[B1] = Date of death;

=DATEDIF(A1,B1,"y")&"y,"&DATEDIF(A1,B1,"ym")&"m,"&DATEDIF(A1,B1,"md")&"d"

Should work OK

Regards
Zanny
 
K

Konczér, Tamás

Hi Susie,

Since I need the same kind of calculation gave a try the above listed
formula. Unfortunately it is not correct, either Excel 2003 and 2007
ask for fixing.

Regards,
Tamas

=YEAR(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1900&" Years "&IF(MONTH(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1=0,"",MONTH(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1&" Months ")&IF(DAY(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1=0,"",DAY(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1&" Days")

Deathdate= D8
Birthdate= B8
On Thursday, February 21, 2008 9:19 AM Anni wrote:
Hi
I work in a hospital and have to calculate what exact age someone is when
they die.  I have birth date and date of death.  How can I calculate in total
the age on death.  Example,   45 years, 4 months and 5 days
Many thanks
Ann Shaw
On Thursday, February 21, 2008 9:30 AM Mike wrote:
Maybe
=DATEDIF(A1,A2,"y")&" y "&DATEDIF(A1,A2,"ym")&" m "&DATEDIF(A1,A2,"md")&" d"
Where a1= DOB
a2 = DOD
Mike H
:
30:02 -0800, Mike H <[email protected]>
wrote:
Since this is in a hospital, and the result probably going on some kind of
legal document, I think you need to have the legal definition of "age" for this
purpose.
Some odd results arise with that formula when it is used for this kind of
determination:
DOB:       31 Jan 1943    
DOD:       01 Mar 2008    
Your Formula:  65 y 1 m -1 d
--ron
On Thursday, February 21, 2008 12:02 PM Rick Rothstein \(MVP - VB\) wrote:
I've always thought measuring a time span using years, months and days is
somewhat useless as the months part is not a very definitive increment. The
number of days spanned by some number of months differs depending onthe
months being spanned. Hell, even years can be somewhat problematic give the
occurrence of leap years within time spans; but, when used by itselfas a
"rough" indicator of time span, this if fine; however, the accuracy implied
by specifying a time span in years, months and days has always bothered me
(way more so than simply specifying years and days, even though I recognize
the inaccuracy introduced by the leap years here).
Rick
On Thursday, February 21, 2008 12:49 PM Niek Otten wrote:
<way more so than simply specifying years and days,>
Indeed. Financial (and actuarial, my area of interest) systems often use this. But because product specifications often *do* refer
to months, the 360-day system is somewhat popular in those groups. Not that it's perfect!
It assumes a 360-day year, consisting of 12 30-day months.
As you can imagine, the remaining 5 or 6 days are subject to lots of different interpretations, but AFAIK they boil down to 2
systems; NASD or European (see HELP for DAYS360).
If only customers would specify what "number of months difference" means (to them).....
--
Kind regards,
Niek Otten
Microsoft MVP - Excel
02:14 -0500, "Rick Rothstein \(MVP - VB\)"
In general I agree with you, but there are certain legal ramifications in
certain areas, and, if clarified, can allow one to express a time span even
with the inclusion of "months".
For example, some kinds of aviation certifications are defined in terms of
"calendar months".  The meaning is clear (if you know the definition), but not
something that can be computed (easily) using DATEDIF.
--ron
[A1] = date of birth;
[B1] = Date of death;
=DATEDIF(A1,B1,"y")&"y,"&DATEDIF(A1,B1,"ym")&"m,"&DATEDIF(A1,B1,"md")&"d"
Should work OK
Regards
Zanny
On Sunday, February 27, 2011 6:48 PM Susie Toews wrote:
=YEAR(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1900&" Years "&IF(MONTH(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1=0,"",MONTH(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1&" Months ")&IF(DAY(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1=0,"",DAY(DATE(YEAR(D8)-YEAR(B8),MONTH(D8)-MONTH(B8)+1,DAY(D8)-DAY(B8)+1))-1&" Days")
Submitted via EggHeadCafe
SQL Server Table Valued Parameters / Types - Multiple Row Inserts
http://www.eggheadcafe.com/tutorials/aspnet/1b4677b6-3be6-4b68-897f-e...
 
J

joeu2004

Since I need the same kind of calculation gave a try the
above listed formula. Unfortunately it is not correct,
either Excel 2003 and 2007 ask for fixing.

If B8 is the birth date and D8 is the date of death, then ostensibly
do:

=DATEDIF(B8,D8,"y")

Caveat: DATEDIF does not handle Feb 29 "correctly", where "correctly"
means: consistent with EDATE. If B8 is 2/29/1948 and D8 is
2/28/2011, most people would consider the 63 years, not 62.

If you that is what you want, too, then do:

=DATEDIF(B8,D8,"y")
+(D8=EDATE(B8,12+12*DATEDIF(B8,D8,"y")))

Note: If you get a #NAME error in XL2003, you need to install the
ATP. If you cannot or do not want to install the ATP, an alternative
is possible, but it would be best to use a helper cell in that case.
Let us know if you need the alternative.
 
J

joeu2004

=DATEDIF(B8,D8,"y")
+(D8=EDATE(B8,12+12*DATEDIF(B8,D8,"y")))
[....]
Since th OP also wanted months and days, Datedif
may be inappropriate.

Well, DATEDIF(...,"y") alone. My bad: I did not see the forest for
the trees. I tend to look askance at responses to 3-year-old
questions in the first place.

But assuming that Tamas is interested in a year/month/day solution, I
would be inclined to use a helper cell, to wit:

X1:
=DATEDIF(B8,D8,"m")+(D8=EDATE(B8,1+DATEDIF(B8,D8,"m")))

Then the year/month/day string can be constructed using:

=INT(X1/12) & " years, "
& X1-12*INT(X1/12) & " months, "
& D8-EDATE(B8,X1) & " days"

But for those that like one-liners:

=DATEDIF(B8,D8,"y")
+(D8=EDATE(B8,12+12*DATEDIF(B8,D8,"y")))
& " years, "
& MOD(DATEDIF(B8,D8,"m")
+(D8=EDATE(B8,1+DATEDIF(B8,D8,"m"))),12)
& " months, "
& D8-EDATE(B8,DATEDIF(B8,D8,"m"))
-(D8=EDATE(B8,1+DATEDIF(B8,D8,"m")))
& " days"

PS: I am not aware of any defects with DATEDIF(...,"y") and
DATEDIF(...,"m") other than its dubious handling of leap dates. But I
know that some people advocate not using DATEDIF at all (at least
starting with XL2007 SP2) because of the defect with
DATEDIF(...,"md"). For consistency, they should also advocate not
using ROUND, INT and MOD, to name a few, because each has defects at
least in XL2003 and later.
 
J

joeu2004

The function apparently broke in one of the SP's for
2007, but I can't recall if it was SP1 or SP2. I have
SP2 and it definitely is broken.

According to Rick Rothstein, MVP: "The problem didn't come about with
Excel 2007, rather, it came about with Service Pack 2 for Excel 2007".
 
J

joeu2004

But I prefer a UDF to output my desired string: [....]
Function DateIntvl(d1 As Date, d2 As Date) As String

Your function returns "12 months" instead of "1 year" for the dates
2/29/1948 and 2/29/1949 (d1 and d2).

Without debugging your mistake, I think the implementation of the
output construction can be greatly simplfied, IMHO. See the revision
at the end below.

I was going to suggest using VBA DateDiff since that __is__ documented
in VBA Help and presumably supported.

But it has some odd quirks, one of which is documented, to wit: "When
comparing December 31 to January 1 of the immediately succeeding year,
DateDiff for Year ("yyyy") returns 1 even though only a day has
elapsed".

Actually, the same "round up" error arises when the start when the
interval is "m" (months).

I did not bother to vet your Excel implementation.

But an errata of my own.... I made a mistake in a last-minute
misguided "simplification" of the last subexpression (days). I should
have written:

=DATEDIF(A4,B4,"y")
+(B4=EDATE(A4,12+12*DATEDIF(A4,B4,"y")))
& " years, "
& MOD(DATEDIF(A4,B4,"m")
+(B4=EDATE(A4,1+DATEDIF(A4,B4,"m"))),12)
& " months, "
& B4-EDATE(A4,DATEDIF(A4,B4,"m")
+(B4=EDATE(A4,1+DATEDIF(A4,B4,"m"))))
& " days"

-----

Simplified DateIntvl:

Option Explicit

Function DateIntvl(d1 As Date, d2 As Date) As String
Dim i As Double
Dim yr As Long, mnth As Long, dy As Long
Dim s As String

'NOTE: It would be prudent for the type of DateIntvl
'to be Variant and return an appropriate CVErr() if
'd1>=d2

yr = Year(d2) - Year(d1) + (d2 < DateSerial(Year(d2), Month(d1),
Day(d1)))

i = 0
Do Until DateAdd("m", yr * 12 + i, d1) > d2
i = i + 1
Loop
mnth = i - 1

dy = d2 - DateAdd("m", yr * 12 + mnth, d1)

If yr > 0 Then s = ", " & yr & IIf(yr = 1, " year", " years")
If mnth > 0 Then _
s = s & ", " & mnth & IIf(mnth = 1, " month", " months")
If dy > 0 Or (yr = 0 And mnth = 0) Then _
s = s & ", " & dy & IIf(dy = 1, " day", " days")
DateIntvl2 = Mid(s, 3)

End Function

NOTE: "Or (yr = 0 And mnth = 0)" becomes unnecessary if you add the
d1>=d2 suggested error checking.
 
J

joeu2004

But I prefer a UDF to output my desired string: [....]
Function DateIntvl(d1 As Date, d2 As Date) As String

Your function returns "12 months" instead of "1 year" for
the dates 2/29/1948 and 2/29/1949 (d1 and d2).

Obvious typo: 2/29/1948 and 2/28/1949.

Sigh, I've really gotten used to the Edit feature in the Answers
Forum ;-).
 
J

joeu2004

I assume you mean 2/28/1949 for d2.

Good "assumption". I said as much in my follow-up errata that I
posted nearly 4.5 hours before your response.
But how to handle that situation is not entirely clear,
and also gets into legalities.

Non sequitur. My point was: your VBA function outputs "12 months",
and I believe 12 months is synonymous with "1 year" in anyone's book.

(Well, anyone that follows the so-called Western calendar. ;->)
In the US I have read, but not been able to definitively
document, that "most" states consider the leapling to have
his/her birthday on Mar 1 of the common year.

I have never heard or read of that in the US. On the contrary....

As the wiki page that you read states: "English law of 1256 decreed
that in leap years, the leap day and the day before [...] are to be
reckoned as one day for the purpose of calculating when a full year
had passed. In England and Wales a person born on February 29 legally
reaches the age of 18 or 21 on February 28 of the relevant year".

English law before the US independence is called Common Law in the
US. And Common Law, especially civil common law, is generally
followed in the US unless there is statutory or constitutional law
(including written case law) to the contrary.

For example, Calif Civil Code section 22.2 says as much directly.

(But I have not researched Calif law to see if it states anything
different for the anniversary of Feb 29 per se.)

The website http://www.leapyearday.com/driverslicenses.htm has several
anecdotal stories where Feb 28 was recognized as the anniversary of a
Feb 29 birth date by states. One writer states: "the Texas
Department of Public Safety has since changed the format
of the driver's license [...]. When my expiration date is not in a
Leap Year, it shows as expiring on February 28th".

I believe that US federal law uses Feb 28 as the anniversary of Feb 29
where applicable. But I would have to do a "full-court press" to do
the legal research properly.

As suggestive, albeit not dispositive evidence, note that the Truth In
Lending Act, Appendix J states: "If a series of payments (or
advances) is scheduled for the last day of each month, months shall be
measured from the last day of the given month to the last day of
another month. If payments (or advances) are scheduled for the 29th or
30th of each month, the last day of February shall be used when
applicable".

(But even if I could find dispositive of federal law, I am not saying
that is binding on the states in areas that are not controlled by
federal law.)

But really, this issue is neither here nor there.

I had simply noted at the outset that __my__ goal was to be consistent
with EDATE, which does treat Feb 28 as the anniversary of Feb 29. And
I wrote: "If you [sic] that is what you want, too, then do" the
following.

You do not have to agree with that goal. But then it seems odd that
you rely on EDATE in your Excel formulation.

And it seems odd that your VBA implementation returns 12 months. If
your position is that Feb 28 is not 1 year after Feb 29, then I would
expect your result to be 11 months 30 days, since
"2/28/2009"-"1/29/2009" is 30.

I started using IIF's and even nested IIF's and found it
easier to set up the array and let the Join function handle
the <comma><space> delimiter.

If you want to use an array and Join, that's your prerogative.

But your justification does not wash. You are using If...Then and
IIf() exactly as I use them.

You wrote ("reformatted to fit your screen"):
If yr > 0 Then _
sOutput(0) = yr & IIf(yr = 1, " year", " years")
If mnth > 0 Then _
sOutput(0 - (yr > 0)) _
= mnth & IIf(mnth = 1, " month", " months")
If dy > 0 Or (yr = 0 And mnth = 0) Then _
sOutput(0 - (yr > 0) - (mnth > 0)) _
= dy & IIf(dy = 1, " day", " days")

I wrote:
If yr > 0 Then _
s = ", " & yr & IIf(yr = 1, " year", " years")
If mnth > 0 Then _
s = s & ", " & mnth & IIf(mnth = 1, " month", " months")
If dy > 0 Or (yr = 0 And mnth = 0) Then _
s = s & ", " & dy & IIf(dy = 1, " day", " days")

There is nothing "easier" about your implementation with respect to
IIf() and If...Then per se. Both of our implementations are identical
in that respect.

The only difference is that I append to string variable "s", then clip
the first 2 characters (always ", "), whereas you allocate (Redim)
array "sOutput0" and use Join to concatenate the sOutput0 components
with a ", " separator.

Obviously, which is "simpler" is subjective. That is why I wrote
"IMHO".
 
J

joeu2004

MICHIGAN VEHICLE CODE  http://www.legislature.mi.gov/(S(cqpjgqz4zicjfcmegalsivns))/m...
257.4a Birthday defined. [....]
Maine Motor Vehicle Code:    http://www.mainelegislature.org/legis/statutes/29-A/title29-A.pdf
29-A  1406. Expiration
3. Leap year birthday. For the purposes of this section,
a person born on February 29th is deemed to have been born
on March 1st.

Thanks for those citation. I guess I was wrong about how uniform the
treatment of Feb 29 anniversaries is across the US.

In any case, I reiterate: my goal was to be consistent with EDATE's
handling of the Feb 29 anniversary, not with any particular laws.
However, it is interesting that by using a previous version
of my UDF [...] gives the "1 year" result.

So we seem to be in "violent agreement".

Independent of how you choose to handle the Feb 29 anniversary (an
unrelated issue), the point is: it is no more correct to output "12
months" instead of "1 year" from a routine that breaks down date
intervals into year/month/days than it would be to output "60 minutes"
instead of "1 hour" from a routine that breaks down time intervals
into hour/minute/seconds.

I do not believe the first implementation of your UDF presented in
this thread returns "12 months" for any other start/end date pair.
And IMHO, there is no rational reason to think that it should for the
Feb29-to-Feb28 interval -- to think that "12 months" has some special
meaning specific to that unique circumstance.

It is a simple defect -- which is the only point I was trying to make
originally.
 
G

Gord Dibben

I am running SP2...............not broke<g>

Don't know if I ever installed SP1.


Gord
 
R

Rick Rothstein

I am running SP2...............not broke<g>

I get 4 as an answer also, however, those dates were not the ones I posted
to show the problem. Try this formula in one of your XL2007 cells...

=DATEDIF(DATE(2009,6,27),DATE(2012,1,5),"md")

In my copy of XL2007 SP2, I get an answer of 122... it should be 9. What
answer do you get?

Rick Rothstein (MVP - Excel)
 
R

Rick Rothstein

According to Rick Rothstein, MVP: "The problem didn't come
about with Excel 2007, rather, it came about with Service
Pack 2 for Excel 2007".

Below my signature is the message I posted to the newsgroups back when this
problem first surfaced.

Rick Rothstein (MVP - Excel)

From a previous newsgroup posting of mine…

You might want to reconsider using the DATEDIF function. It is an
undocumented (and, thus, probably an unsupported) Excel function which
appears to be broken in XL2007 at Service Pack 2. Someone recently posted
this message as part of a newsgroup question…

**********************************************************************
=DATEDIF(DATE(2009,6,27),DATE(2012,1,5),â€mdâ€)

In 2007, this gives me 122. This happens all the way up to the point
where the second date is 1/26/2012 and then it hits zero at 1/27/2012.
In 2002, however, it gives me the correct answer of 9.
**********************************************************************

An informal survey of fellow MVPs shows the above formula works correctly in
the initial release of XL2007 and its SP1, but does not work correctly in
SP2; hence, it appears to be broken at that level. The problem is that the
extent of the breakage is unknown (and probably indeterminable). In
addition, I would say, being an undocumented (and, thus, probably and
unsupported) function, the odds of Microsoft spending the time to search
down and fix whatever broke is slim. This would seem to mean that DATEDIF
cannot be counted on to work correctly from XL2007 SP2 onward. And even if
Microsoft did fix the problem in a subsequent Service Pack, any of your
users who remained at SP2 would be subjected to incorrect result.
 

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

Top