Link to home
Create AccountLog in
Avatar of jph826
jph826

asked on

Age as of Jan 1 current year

I need a formula to calculate an employee's age as of January 1 of the current year.  

I need another formula to calculate an employee's age as of January 1 of the upcoming year.  

Any assistance would be greatly appreciated.  Thanks
Avatar of Ido Millet
Ido Millet
Flag of United States of America image

DateVar BirthDate := {Your_BirthDate_Field};
DateVar Start_year := Date(Year(currentdate), 01, 01);

if (Month(Start_year) * 100) + Day (Start_year) >= (Month(BirthDate) *100) + Day (BirthDate) 
then Year(Start_year) - Year(BirthDate) 
else Year(Start_year) - Year(BirthDate) -1;

Open in new window


And the age at the start of next year is simply the above + 1.
What about those born on 1 Jan?

If someone was born on say , 1 Jan 1983 do you want the answer for the current year to be 30 or 29?
Avatar of jph826
jph826

ASKER

Good question.  I would want their age on January 1, current year, or in your example, 30.  I'm having trouble getting the suggested formula to work.
You should change {Your_BirthDate_Field} to YOUR birthdate column.

If that was not the issue, please explain what type of "problem" you are referring to.
Avatar of jph826

ASKER

Thanks IdoMillet.  It hi-lights MY birthdate field, {PAEMPLOYEE.BIRTHDATE}, and says a date is required here.  If I change it to .... Date {PAEMPLOYEE.BIRTHDATE} it hi-lights everything after Date and returns "the remaining text does not appear to be part of the formula.

{PAEMPLOYEE.BIRTHDATE} is a DateTime field.
What is the data type of {PAEMPLOYEE.BIRTHDATE} ?

Please copy and paste the text of your formula.
ASKER CERTIFIED SOLUTION
Avatar of Ido Millet
Ido Millet
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of jph826

ASKER

That worked, thanks for your assistance!