leopardhawk
Well-known Member
- Joined
- May 31, 2007
- Messages
- 611
- Office Version
- 2016
- Platform
- Windows
Both of these formulas are working (no errors) but not quite up to the standards that I want for the workbook.
The first formula looks at a DOB on worksheet ‘personal_info’!E12 and if it’s blank, returns a blank. Otherwise, it will return a ‘year’ that is based on the DOB of the user. If they are less than 70 years of age, it will always return the year that they turn 70. If they are 70 years of age or older, it returns the current year. The problem with this formula for me is that I want the formula to always return the year they turn 70 but based on the END of the year they turn 70.
For example, I entered a DOB of May 11, 1970. Because May 11, 2019 has already passed, the formula returns 2039. If I change the date to September 11, 1970, the formula returns 2040 as the year. I want it to return 2040 for the entire calendar year regardless of the month/day of the birth date.
The second formula is related in that it shows the age of the user. The formula looks at a DOB on worksheet ‘personal_info’!E12 and if it’s blank OR if the user is less than 70 years of age, returns 70 (this is what I want). If the user is less than 70, it will always return 70. If they are 70 years of age or older, it will return their current age but just like the first formula, I want it to be at the end of the year that they turn whatever age they are.
For example, I entered a DOB of May 11, 1938. Because May 11, 2019 has already passed, the formula returns 81. If I change the date to September 11, 1938, the formula returns 80 as the age. I want it to return 81 for the entire calendar year regardless of the month/day of the birth date.
I hope this makes sense and is any easy fix.
The first formula looks at a DOB on worksheet ‘personal_info’!E12 and if it’s blank, returns a blank. Otherwise, it will return a ‘year’ that is based on the DOB of the user. If they are less than 70 years of age, it will always return the year that they turn 70. If they are 70 years of age or older, it returns the current year. The problem with this formula for me is that I want the formula to always return the year they turn 70 but based on the END of the year they turn 70.
For example, I entered a DOB of May 11, 1970. Because May 11, 2019 has already passed, the formula returns 2039. If I change the date to September 11, 1970, the formula returns 2040 as the year. I want it to return 2040 for the entire calendar year regardless of the month/day of the birth date.
Code:
=IF(personal_info!$E$12="","",IF(DATEDIF(personal_info!$E$12,TODAY(),"y")<70,YEAR(TODAY())+(70-DATEDIF(personal_info!$E$12,TODAY(),"y"))-1,YEAR(TODAY())))
The second formula is related in that it shows the age of the user. The formula looks at a DOB on worksheet ‘personal_info’!E12 and if it’s blank OR if the user is less than 70 years of age, returns 70 (this is what I want). If the user is less than 70, it will always return 70. If they are 70 years of age or older, it will return their current age but just like the first formula, I want it to be at the end of the year that they turn whatever age they are.
For example, I entered a DOB of May 11, 1938. Because May 11, 2019 has already passed, the formula returns 81. If I change the date to September 11, 1938, the formula returns 80 as the age. I want it to return 81 for the entire calendar year regardless of the month/day of the birth date.
Code:
=IF(personal_info!$E$12="",70,IF(DATEDIF(personal_info!$E$12,DATE(B16,MONTH(TODAY()),DAY(TODAY())),"y")>70,DATEDIF(personal_info!$E$12,DATE(B16,MONTH(TODAY()),DAY(TODAY())),"y"),70))
I hope this makes sense and is any easy fix.