converting date of birth to age.

john doe the 3rd

New Member
Joined
Mar 13, 2004
Messages
47
hi guys


i have 2 fields in a table one titled " dob " and the other "current age"

i want to create a form for this table that will display the date value of dob and also display the current age in the field next to it but i would like the current age to appear automatically based on the date of birth.

example :

user enter 04/09/1988 (british DD/MM/YYYY )

current age text box in form automatically displays value of "16" , i.e the person is 16 years old. the table would then update and save this value.

the "dob" field is input masked with this DD/MM/YYYY mask so that date of birth will remain a constant format.



thanks.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi

Rather than store the value in the table, it would be better calculating the age "on the fly" on the forms and reports given every single age you update today will be wrong in one years time and as such the field will require constant updating. Try this formula in your queries that are to be used as the basis for any forms and reports that require the age :

Age : Format(Now()-[dob]+1,"yy")

Make sure you use your date of birth variable name. The plus 1 is to correct the formula showing the incorrect age for the birthday anniversary.

HTH, Andrew. :)
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,250
Members
451,757
Latest member
iours

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top