age rounding up or down

A

Abe

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?
 
K

Klatuu

CalcAge = DateDiff("yyyy", BirthDate, DateToday) _
- IIf(Format(DateToday, "mmdd") < Format(BirthDate, "mmdd"), 1, 0)
 
J

John W. Vinson

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

Abe

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

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