View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default Calculating age of death

On Thu, 3 Mar 2011 21:39:13 -0800 (PST), joeu2004 wrote:

Good "assumption". I said as much in my follow-up errata that I
posted nearly 4.5 hours before your response.


And had I seen it before I posted mine, I would have mentioned it. Or did you bring this up for some other reason that would contribute to our discussion?


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....


The first below was cited in an article I read. The second is where I live. Haven't gone through any other legal research in the US.

MICHIGAN VEHICLE CODE http://www.legislature.mi.gov/%28S%2...ary%20AND%2029

257.4a “Birthday” defined.

Sec. 4a.

“Birthday” shall mean any anniversary of the original date of birth, and all persons born on February 29 shall be deemed, for the purposes of this act, to have been born on March 1.

-------------------------------------------------

Maine Motor Vehicle Code: http://www.mainelegislature.org/legi.../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.

---------------------------------------------------

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.


Yes that is true, but in this one instance, I am uncertain how to treat that time interval.

However, it is interesting that by using a previous version of my UDF, from 2006, (http://www.pcreview.co.uk/forums/hav...-t2506504.html) which I subsequently "updated" by calculating "years" first, gives the "1 year" result. This version has not had the "prettied up" output:

=======================================
Option Explicit
Function DateIntvl2(d1 As Date, d2 As Date) As String
Dim temp As Date
Dim i As Double
Dim yr As Long, mnth As Long, dy As Long
Dim Yrstr As String, Mnstr As String, Dystr As String

Do Until temp d2
i = i + 1
temp = DateAdd("m", i, d1)
Loop

i = i - 1
temp = DateAdd("m", i, d1)

yr = Int(i / 12)
mnth = i Mod 12
dy = d2 - temp
Yrstr = IIf(yr = 1, " yr ", " yrs ")
Mnstr = IIf(mnth = 1, " month ", " months ")
Dystr = IIf(dy = 1, " day", " days")

DateIntvl2 = yr & Yrstr & mnth & Mnstr & dy & Dystr

End Function
=========================================