View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default Calculating age of death

On Mar 3, 7:26 pm, Ron Rosenfeld wrote:
On Thu, 3 Mar 2011 14:54:09 -0800 (PST), joeu2004 wrote:
Your function returns "12 months" instead of "1 year"
for the dates
2/29/1948 and 2/29/1949 (d1 and d2).


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.

You wrote:
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. ;-)

You wrote:
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.


You wrote:
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".