If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
age rounding up or down
I'm using this formula from the office help to calculate a birthdate:
=DateDiff("yyyy", [Birthdate], Now())+ Int( Format(now(), "mmdd") Format( [Birthdate], "mmdd") ) My fields have the same name, but my query is outputting the wrong age - rounding up or down. How can I make it exact? -- Thanks, Abe |
#2
|
|||
|
|||
age rounding up or down
CalcAge = DateDiff("yyyy", BirthDate, DateToday) _
- IIf(Format(DateToday, "mmdd") Format(BirthDate, "mmdd"), 1, 0) -- Dave Hargis, Microsoft Access MVP "Abe" wrote: I'm using this formula from the office help to calculate a birthdate: =DateDiff("yyyy", [Birthdate], Now())+ Int( Format(now(), "mmdd") Format( [Birthdate], "mmdd") ) My fields have the same name, but my query is outputting the wrong age - rounding up or down. How can I make it exact? -- Thanks, Abe |
#3
|
|||
|
|||
age rounding up or down
On Wed, 16 Sep 2009 09:19:02 -0700, Abe wrote:
I'm using this formula from the office help to calculate a birthdate: =DateDiff("yyyy", [Birthdate], Now())+ Int( Format(now(), "mmdd") Format( [Birthdate], "mmdd") ) My fields have the same name, but my query is outputting the wrong age - rounding up or down. How can I make it exact? The expression returns the age in years as an integer. I turned 63 on May 16, and I'll be 63 until May 16 next year. That's the purpose of the expression! What do you have in Birthdate? What is it that you're trying to calculate (you say "to calculate a birthdate" but the expression assumes you HAVE a birthdate). Please explain what you have and what you want. -- John W. Vinson [MVP] |
#4
|
|||
|
|||
age rounding up or down
Sorry I wasn't clear. I'm trying to get the age, but that formula didn't
return the exact age, it made the person younger or older depending on the proximity of the current month. I got the answer in the next post though! -- Thanks anyway, Abe "John W. Vinson" wrote: On Wed, 16 Sep 2009 09:19:02 -0700, Abe wrote: I'm using this formula from the office help to calculate a birthdate: =DateDiff("yyyy", [Birthdate], Now())+ Int( Format(now(), "mmdd") Format( [Birthdate], "mmdd") ) My fields have the same name, but my query is outputting the wrong age - rounding up or down. How can I make it exact? The expression returns the age in years as an integer. I turned 63 on May 16, and I'll be 63 until May 16 next year. That's the purpose of the expression! What do you have in Birthdate? What is it that you're trying to calculate (you say "to calculate a birthdate" but the expression assumes you HAVE a birthdate). Please explain what you have and what you want. -- John W. Vinson [MVP] |
Thread Tools | |
Display Modes | |
|
|