Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding Down

Status
Not open for further replies.

cunner26

Technical User
Nov 18, 2002
9
CA
I am working on a retirement report and I need the age of the person to round down to the nearest whole number. I am currently using the following formula to establish the number of years,

(March 31, 2004 - Birthdate)/365

For some people, this report shows 64.6, and then when I try to round it rounds up to 65. I need the report to show them rounded to 64.

Thanks for any help you can provide,
 
chelseatech posted a great AGE formula a while back and I use this all the time now:

Here is the thread: thread767-491770

and here is the formula:
-----------------------------------------------------
if month({table.birthdate}) < month(CurrentDate) or
//Had their birthday earlier in the year
(month({table.birthdate}) = month(CurrentDate) and
(day({table.birthdate}) <= day(CurrentDate))
//Had their birthday earlier this month
Then
year(CurrentDate) - year({table.birthdate})
else
year(CurrentDate) - year({table.birthdate}) -1
-----------------------------------------------------

Use this formula instead of the one you are trying to use. It will return the age without the fraction. It is more accurate than dividing by 365 since it accounts for leap years.

In a situation where you need to Round Down, use the Truncate function to drop the decimal portion.

Truncate(1.5678)

Returns 1.


~Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top