Works: Calculating an Age from a Date in Database or Spreadsheet (131734)
The information in this article applies to:
- Microsoft Works 6
- Microsoft Works 2000
- Microsoft Works 3.0
- Microsoft Works 4.0
- Microsoft Works 4.5
This article was previously published under Q131734 SUMMARY
In the Spreadsheet and Database modules of Works for Windows, it is
possible to calculate a person's age based on the current date and a date
that has been entered into a database field or spreadsheet cell.
MORE INFORMATION
The following formula will calculate a person's age from information
that has been entered as a date
=IF(<fieldname><>"",INT((NOW()-<fieldname>)/365.24),"")
where <fieldname> is either the name of the field or the cell
reference containing the birth date. See below for both a database and
a spreadsheet example.
NOTE: It is important to type two double quotation marks ("") next to each other, without a space in between the quotation marks. If there is a space, Works 4.0 or later will calculate a different answer, due to its ability to distinguish between an actual blank and a space.
Database Example
In the example below, BDate is the birthdate and AgeNow is the person's
current age.
BDate AgeNow
1 1/1/70 =IF(BDate<>"",INT((NOW()-BDate)/365.24),"")
For example, if the current date is 9/1/95, this will display (in list
view):
BDate AgeNow
1 1/1/70 25
2 3/15/65 30
3 >---(BDate is blank so AgeNow is also blank.)
4 2/10/61 34
Spreadsheet Example
A B
1 1/1/70 =IF(A1<>"",INT((NOW()-A1)/365.24),"")
If the current date is 9/1/95, this will display:
A B (Highlight the cells in column B as far down as
1 1/1/70 25 you want the formula repeated, and then
click Fill Down on the Edit menu.)
Modification Type: | Major | Last Reviewed: | 11/24/2003 |
---|
Keywords: | kbhowto kbui KB131734 |
---|
|