Calculate age at future date from DOB

G

Guest

I need to be able to calculate a woman's age at the time of her baby's birth,
based on the dates recorded in her DOB and EDD (estimated date of delivery)
fields (i.e. calculate her "Age @ EDD"). Can anyone help me out? Many
thanks!
 
D

Douglas J. Steele

To calculate the age at any particular date, try:

DateDiff("yyyy", [DOB], [EDD]) - _
IIf(Format([EDD], "mmdd") < Format([DOB], "mmdd")), 1, 0)
 
G

Guest

I love ya, Doug--it worked with only very minor tweaking!!
=DateDiff("yyyy",[DOB],[EDD])-IIf(Format([EDD],"mmdd")<Format([DOB],"mmdd"),1,0)
Many thanks!

Douglas J. Steele said:
To calculate the age at any particular date, try:

DateDiff("yyyy", [DOB], [EDD]) - _
IIf(Format([EDD], "mmdd") < Format([DOB], "mmdd")), 1, 0)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Guate said:
I need to be able to calculate a woman's age at the time of her baby's
birth,
based on the dates recorded in her DOB and EDD (estimated date of
delivery)
fields (i.e. calculate her "Age @ EDD"). Can anyone help me out? Many
thanks!
 
G

Guest

I'm trying to calculate the age at future date (2002) from DOB in acces.
the DOB name is Driver DOB and is like this mm/dd/yyyy. For example convert
this 01/01/56 to 2002 (begining of 2002)
thanks

Douglas J. Steele said:
To calculate the age at any particular date, try:

DateDiff("yyyy", [DOB], [EDD]) - _
IIf(Format([EDD], "mmdd") < Format([DOB], "mmdd")), 1, 0)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Guate said:
I need to be able to calculate a woman's age at the time of her baby's
birth,
based on the dates recorded in her DOB and EDD (estimated date of
delivery)
fields (i.e. calculate her "Age @ EDD"). Can anyone help me out? Many
thanks!
 
A

Allen Browne

See:
http://allenbrowne.com/func-08.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Papa said:
I'm trying to calculate the age at future date (2002) from DOB in acces.
the DOB name is Driver DOB and is like this mm/dd/yyyy. For example
convert
this 01/01/56 to 2002 (begining of 2002)
thanks

Douglas J. Steele said:
To calculate the age at any particular date, try:

DateDiff("yyyy", [DOB], [EDD]) - _
IIf(Format([EDD], "mmdd") < Format([DOB], "mmdd")), 1, 0)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Guate said:
I need to be able to calculate a woman's age at the time of her baby's
birth,
based on the dates recorded in her DOB and EDD (estimated date of
delivery)
fields (i.e. calculate her "Age @ EDD"). Can anyone help me out? Many
thanks!
 
G

Guest

it didn't work, there is mistake somewhere. What I did, was:
=DateDiff("yyyy", [Driver DOB], [2002]) - IIf(Format([2002], "mmdd") <
Format([Driver DOB], "mmdd")), 1, 0) and ran it
thanks

Papa said:
I'm trying to calculate the age at future date (2002) from DOB in acces.
the DOB name is Driver DOB and is like this mm/dd/yyyy. For example convert
this 01/01/56 to 2002 (begining of 2002)
thanks

Douglas J. Steele said:
To calculate the age at any particular date, try:

DateDiff("yyyy", [DOB], [EDD]) - _
IIf(Format([EDD], "mmdd") < Format([DOB], "mmdd")), 1, 0)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Guate said:
I need to be able to calculate a woman's age at the time of her baby's
birth,
based on the dates recorded in her DOB and EDD (estimated date of
delivery)
fields (i.e. calculate her "Age @ EDD"). Can anyone help me out? Many
thanks!
 
D

Douglas J. Steele

What is [2002]: a field in your table, a control on your form, or are you
trying to use the constant 2002?

2002 isn't a date... If you're trying to see what their age was on, say,
January 1st, 2002, you'll need to use

=DateDiff("yyyy", [Driver DOB], #01/01/2002#) - IIf("0101" < Format([Driver
DOB], "mmdd"), 1, 0)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Papa said:
it didn't work, there is mistake somewhere. What I did, was:
=DateDiff("yyyy", [Driver DOB], [2002]) - IIf(Format([2002], "mmdd") <
Format([Driver DOB], "mmdd")), 1, 0) and ran it
thanks

Papa said:
I'm trying to calculate the age at future date (2002) from DOB in acces.
the DOB name is Driver DOB and is like this mm/dd/yyyy. For example
convert
this 01/01/56 to 2002 (begining of 2002)
thanks

Douglas J. Steele said:
To calculate the age at any particular date, try:

DateDiff("yyyy", [DOB], [EDD]) - _
IIf(Format([EDD], "mmdd") < Format([DOB], "mmdd")), 1, 0)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I need to be able to calculate a woman's age at the time of her baby's
birth,
based on the dates recorded in her DOB and EDD (estimated date of
delivery)
fields (i.e. calculate her "Age @ EDD"). Can anyone help me out?
Many
thanks!
 
G

Guest

I still didn't get anything. Do I have to change something in the formula? I
just copy and paste it.let me explain again. the first column is year all in
2002 and the other column is Driver DOB (for example, 01/15/1956).
=DateDiff("yyyy", [Driver DOB], #01/01/2002#) - IIf("0101" < Format([Driver
DOB], "mmdd"), 1, 0)
thanks

Douglas J. Steele said:
What is [2002]: a field in your table, a control on your form, or are you
trying to use the constant 2002?

2002 isn't a date... If you're trying to see what their age was on, say,
January 1st, 2002, you'll need to use

=DateDiff("yyyy", [Driver DOB], #01/01/2002#) - IIf("0101" < Format([Driver
DOB], "mmdd"), 1, 0)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Papa said:
it didn't work, there is mistake somewhere. What I did, was:
=DateDiff("yyyy", [Driver DOB], [2002]) - IIf(Format([2002], "mmdd") <
Format([Driver DOB], "mmdd")), 1, 0) and ran it
thanks

Papa said:
I'm trying to calculate the age at future date (2002) from DOB in acces.
the DOB name is Driver DOB and is like this mm/dd/yyyy. For example
convert
this 01/01/56 to 2002 (begining of 2002)
thanks

:

To calculate the age at any particular date, try:

DateDiff("yyyy", [DOB], [EDD]) - _
IIf(Format([EDD], "mmdd") < Format([DOB], "mmdd")), 1, 0)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I need to be able to calculate a woman's age at the time of her baby's
birth,
based on the dates recorded in her DOB and EDD (estimated date of
delivery)
fields (i.e. calculate her "Age @ EDD"). Can anyone help me out?
Many
thanks!
 
D

Douglas J. Steele

What happens when you try it? Do you get an error message? If so, what is
it? Where are you trying to use the formula?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Papa said:
I still didn't get anything. Do I have to change something in the formula?
I
just copy and paste it.let me explain again. the first column is year all
in
2002 and the other column is Driver DOB (for example, 01/15/1956).
=DateDiff("yyyy", [Driver DOB], #01/01/2002#) - IIf("0101" <
Format([Driver
DOB], "mmdd"), 1, 0)
thanks

Douglas J. Steele said:
What is [2002]: a field in your table, a control on your form, or are you
trying to use the constant 2002?

2002 isn't a date... If you're trying to see what their age was on, say,
January 1st, 2002, you'll need to use

=DateDiff("yyyy", [Driver DOB], #01/01/2002#) - IIf("0101" <
Format([Driver
DOB], "mmdd"), 1, 0)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Papa said:
it didn't work, there is mistake somewhere. What I did, was:
=DateDiff("yyyy", [Driver DOB], [2002]) - IIf(Format([2002], "mmdd") <
Format([Driver DOB], "mmdd")), 1, 0) and ran it
thanks

:

I'm trying to calculate the age at future date (2002) from DOB in
acces.
the DOB name is Driver DOB and is like this mm/dd/yyyy. For example
convert
this 01/01/56 to 2002 (begining of 2002)
thanks

:

To calculate the age at any particular date, try:

DateDiff("yyyy", [DOB], [EDD]) - _
IIf(Format([EDD], "mmdd") < Format([DOB], "mmdd")), 1, 0)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I need to be able to calculate a woman's age at the time of her
baby's
birth,
based on the dates recorded in her DOB and EDD (estimated date of
delivery)
fields (i.e. calculate her "Age @ EDD"). Can anyone help me out?
Many
thanks!
 

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