Format a number in a calculated field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table with personal client information. One field shows date of
birth; the next field has a calculated expression showing the person's age:
=(Date()-[DateOfBirth])/365.

My problem is, the result is displayed to 7 decimal places. How do I format
it to round off as a whole number?
 
PeterK said:
I have a table with personal client information. One field shows date of
birth; the next field has a calculated expression showing the person's
age:
=(Date()-[DateOfBirth])/365.

=Round((Date()-[DateOfBirth])/365., 0)

This won't, however, give a true age since it doesn't take into account leap
years.

Tom Lake
 
Peter

Two answers:

First, DON'T! As soon as you insert the calculated Age for a row, you risk
being wrong. How frequently (every day, once a month, once a year) will you
"refresh" this calculation? Since you have a calculation that works for you
(although you may wish to check the mvps.org website on this topic), use
this calculation in a query to calculate Age on-the-fly.

Second, the underlying table has data types for the fields. What data type
is the field you are using?
 
Peter,

=Format((Date()-[DateOfBirth])/365, "0")

Instead should do it.

HTH,
Nikos
 
Back
Top