how do i calculate age

S

Shelley

I have tried using the current formula online ...namely...

=DateDiff("yyyy", [Birthdate], Now())+ Int( Format(now(), "mmdd") < Format(
[Birthdate], "mmdd") )


but the program [access] doesn't like this, and keeps spitting it back as
being syntactically, incorrect.

any advice please?

Thank you.
 
K

Ken Snell [MVP]

Try this:

=DateDiff("yyyy", [Birthdate], Now())+ (Int( Format(now(), "mmdd") <
Int(Format(
[Birthdate], "mmdd"))))
 
F

FatMan

uhmmmm....wouldn't this work

=(Now()-[Birthdate])/365.25

of course you would have to set the format to display the number the way you
would like (i.e. standard, 1 decimal). I guess if you didn't want the
fraction you might have tried:
=int((now()-[Birthday]))/365.25

Just my thoughts. Wouldn't mind knowing if someone knows that this wouldn't
work.

Thanks,
FatMan

Ken Snell said:
Try this:

=DateDiff("yyyy", [Birthdate], Now())+ (Int( Format(now(), "mmdd") <
Int(Format(
[Birthdate], "mmdd"))))
--

Ken Snell
<MS ACCESS MVP>

Shelley said:
I have tried using the current formula online ...namely...

=DateDiff("yyyy", [Birthdate], Now())+ Int( Format(now(), "mmdd") < Format(
[Birthdate], "mmdd") )


but the program [access] doesn't like this, and keeps spitting it back as
being syntactically, incorrect.

any advice please?

Thank you.
 
K

Ken Snell [MVP]

It's one of many ways to approximate the age, but no year by the calendar
has 365.25 days. And we calculate age (at least, here in US) based on the
actual calendar date, not the number of days since the birthday.

--

Ken Snell
<MS ACCESS MVP>

FatMan said:
uhmmmm....wouldn't this work

=(Now()-[Birthdate])/365.25

of course you would have to set the format to display the number the way you
would like (i.e. standard, 1 decimal). I guess if you didn't want the
fraction you might have tried:
=int((now()-[Birthday]))/365.25

Just my thoughts. Wouldn't mind knowing if someone knows that this wouldn't
work.

Thanks,
FatMan

Ken Snell said:
Try this:

=DateDiff("yyyy", [Birthdate], Now())+ (Int( Format(now(), "mmdd") <
Int(Format(
[Birthdate], "mmdd"))))
--

Ken Snell
<MS ACCESS MVP>

Shelley said:
I have tried using the current formula online ...namely...

=DateDiff("yyyy", [Birthdate], Now())+ Int( Format(now(), "mmdd") < Format(
[Birthdate], "mmdd") )


but the program [access] doesn't like this, and keeps spitting it back as
being syntactically, incorrect.

any advice please?

Thank you.
 
S

Steve Schapel

Shelley,

I suggest doing it like this...

DateDiff("yyyy",[Birthdate],Date())+(Format([Birthdate],"mmdd")>Format(Date(),"mmdd"))

Part of the problem is to do with your use of the Int() function.
Format(now(), "mmdd") returns a string, so theoretically to find the
integer value of this doesn't make sense. Maybe what you meant was
Format(Int(Now()),"mmdd") which would be ok, but Access already has a
built-in function for Int(Now()) which is called Date().
 
F

FatMan

Ken:
With all due respect, I am not sure your reply to my posting is accurate or
fair in its tone.

To say "you in the US" calculate age based on an actual calendar date and
not the number of days since the birthday......well it just makes no since.
After all, if I use the now() function I do believe it returns the "actual
date" of right now and if I subtract the birthdate from it, it will return
the number of days since the birthday. If one's age is not equal to the
number of days he/she is alive then what is? As to no calander year having
365.25 days in it. You are quite right, every year has 365 days in it, but
every fourth year has that one extra day in it....that is at least here in
Canada and we call it a leap year. Is it not the same in the US?

Ken, like I said with all due respect. I know that I don't know it all and
in fact am the first to admitt that my knowledge is not that of yours.
However, you must understand that just becuase you have the "MS ACCESS MVP"
after your name that it does not give you the right to talk down to those who
know less than you. After all I thought this was a discussion group to offer
helpful suggestions and not belittle someone.

Thanks for your reply,
FatMan

Ken Snell said:
It's one of many ways to approximate the age, but no year by the calendar
has 365.25 days. And we calculate age (at least, here in US) based on the
actual calendar date, not the number of days since the birthday.

--

Ken Snell
<MS ACCESS MVP>

FatMan said:
uhmmmm....wouldn't this work

=(Now()-[Birthdate])/365.25

of course you would have to set the format to display the number the way you
would like (i.e. standard, 1 decimal). I guess if you didn't want the
fraction you might have tried:
=int((now()-[Birthday]))/365.25

Just my thoughts. Wouldn't mind knowing if someone knows that this wouldn't
work.

Thanks,
FatMan

Ken Snell said:
Try this:

=DateDiff("yyyy", [Birthdate], Now())+ (Int( Format(now(), "mmdd") <
Int(Format(
[Birthdate], "mmdd"))))
--

Ken Snell
<MS ACCESS MVP>

I have tried using the current formula online ...namely...

=DateDiff("yyyy", [Birthdate], Now())+ Int( Format(now(), "mmdd") <
Format(
[Birthdate], "mmdd") )


but the program [access] doesn't like this, and keeps spitting it back as
being syntactically, incorrect.

any advice please?

Thank you.
 
K

Ken Snell [MVP]

No disrespect was meant by my reply. I intended to provide a slightly
lighthearted comment about your expression which is only an approximation of
age.

--

Ken Snell
<MS ACCESS MVP>


FatMan said:
Ken:
With all due respect, I am not sure your reply to my posting is accurate or
fair in its tone.

To say "you in the US" calculate age based on an actual calendar date and
not the number of days since the birthday......well it just makes no since.
After all, if I use the now() function I do believe it returns the "actual
date" of right now and if I subtract the birthdate from it, it will return
the number of days since the birthday. If one's age is not equal to the
number of days he/she is alive then what is? As to no calander year having
365.25 days in it. You are quite right, every year has 365 days in it, but
every fourth year has that one extra day in it....that is at least here in
Canada and we call it a leap year. Is it not the same in the US?

Ken, like I said with all due respect. I know that I don't know it all and
in fact am the first to admitt that my knowledge is not that of yours.
However, you must understand that just becuase you have the "MS ACCESS MVP"
after your name that it does not give you the right to talk down to those who
know less than you. After all I thought this was a discussion group to offer
helpful suggestions and not belittle someone.

Thanks for your reply,
FatMan

Ken Snell said:
It's one of many ways to approximate the age, but no year by the calendar
has 365.25 days. And we calculate age (at least, here in US) based on the
actual calendar date, not the number of days since the birthday.

--

Ken Snell
<MS ACCESS MVP>

FatMan said:
uhmmmm....wouldn't this work

=(Now()-[Birthdate])/365.25

of course you would have to set the format to display the number the
way
you
would like (i.e. standard, 1 decimal). I guess if you didn't want the
fraction you might have tried:
=int((now()-[Birthday]))/365.25

Just my thoughts. Wouldn't mind knowing if someone knows that this wouldn't
work.

Thanks,
FatMan

:

Try this:

=DateDiff("yyyy", [Birthdate], Now())+ (Int( Format(now(), "mmdd") <
Int(Format(
[Birthdate], "mmdd"))))
--

Ken Snell
<MS ACCESS MVP>

I have tried using the current formula online ...namely...

=DateDiff("yyyy", [Birthdate], Now())+ Int( Format(now(), "mmdd") <
Format(
[Birthdate], "mmdd") )


but the program [access] doesn't like this, and keeps spitting it
back
as
being syntactically, incorrect.

any advice please?

Thank you.
 

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