Hi,
I need to calculate the age between two dates. I have [Birth_date] and [Entry_date]. The age would be the age at the time of [entry_date]. I tried the following but it gave errors re the way it was written.
Age:DateDiff("yyyy",([entry_date],[birth_date])
I also tried ([entry_date]-[birth_date])/365 but that didn't seem to give me the correct numbers.
Thanks!
Leesha
Calculate age
-
- Administrator
- Posts: 78658
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Calculate age
A quick-and-dirty way of calculating the age in years is
Int(([entry_date]-[birth_date])/365.25)
The .25 in 365.25 takes leap years into account. This will be sufficient for most purposes but it can be off by 1 year in certain circumstances. For an accurate calculation, use
Year([entry_date])-Year([birth_date])+(Month([entry_date])<Month([birth_date]) Or Month([entry_date])=Month([birth_date]) And Day([entry_date])<Day([birth_date]))
Int(([entry_date]-[birth_date])/365.25)
The .25 in 365.25 takes leap years into account. This will be sufficient for most purposes but it can be off by 1 year in certain circumstances. For an accurate calculation, use
Year([entry_date])-Year([birth_date])+(Month([entry_date])<Month([birth_date]) Or Month([entry_date])=Month([birth_date]) And Day([entry_date])<Day([birth_date]))
Best wishes,
Hans
Hans