A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

how do i calculate age



 
 
Thread Tools Display Modes
  #1  
Old November 8th, 2004, 05:10 PM
Shelley
external usenet poster
 
Posts: n/a
Default how do i calculate age

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.

  #2  
Old November 8th, 2004, 05:35 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

Try this:

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

Ken Snell
MS ACCESS MVP

"Shelley" wrote in message
...
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.



  #3  
Old November 8th, 2004, 08:47 PM
FatMan
external usenet poster
 
Posts: n/a
Default

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 [MVP]" wrote:

Try this:

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

Ken Snell
MS ACCESS MVP

"Shelley" wrote in message
...
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.




  #4  
Old November 8th, 2004, 09:01 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

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" wrote in message
...
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 [MVP]" wrote:

Try this:

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

Ken Snell
MS ACCESS MVP

"Shelley" wrote in message
...
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.






  #5  
Old November 8th, 2004, 11:12 PM
Steve Schapel
external usenet poster
 
Posts: n/a
Default

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

--
Steve Schapel, Microsoft Access MVP


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

  #6  
Old November 9th, 2004, 12:43 PM
FatMan
external usenet poster
 
Posts: n/a
Default

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 [MVP]" wrote:

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" wrote in message
...
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 [MVP]" wrote:

Try this:

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

Ken Snell
MS ACCESS MVP

"Shelley" wrote in message
...
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.







  #7  
Old November 9th, 2004, 02:31 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

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" wrote in message
...
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 [MVP]" wrote:

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" wrote in message
...
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 [MVP]" wrote:

Try this:

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

Ken Snell
MS ACCESS MVP

"Shelley" wrote in message
...
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.









  #8  
Old November 9th, 2004, 03:50 PM
Joan Wild
external usenet poster
 
Posts: n/a
Default

FatMan wrote:
Ken:
With all due respect, I am not sure your reply to my posting is
accurate .


=int((now()-[Birthday]))/365.25


This will not be accurate in all cases.

eg. ?int((#2/28/2005#-#2/29/2004)/365.25
0
?int((#3/1/2005#-#12/29/2004#)/365.25)
0
--
Joan Wild
Microsoft Access MVP


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to calculate time difference? barton General Discussion 4 July 13th, 2004 05:49 AM
How to calculate time difference? barton General Discussion 0 July 12th, 2004 06:31 AM
Visual Basic....Calculate Button Don Guillett Worksheet Functions 3 April 2nd, 2004 05:24 PM


All times are GMT +1. The time now is 11:50 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.