![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am attempting to create a simple display of a person's age from his or her birthdate. I want the display to be in the form of 17y 5m and I am running into difficulty. Here is the formula as I have devised it, with Birthdate being a manually-entered date: Let (Age=((Get(CurrentDate)-Birthdate)/365); Int(Left(Age;2)) & "y " & Int(Right(Round(Age;1);1)*(12/10)) & "m") //This long function does the following: //1. Defines a variable that is a person's age, based on Birthdate //2. Pulls out the first two digits as the year //3. Pulls out the last digit and converts it from decimal to month The conversion to y/m display fails with various dates. For instance, if you were to enter "8/1/03", the display would return 2y 2m. If anyone knows why this is happening, or knows of a better formula for accomplishing this task, I would appreciate hearing from you. Rick A. Pleasanton, CA |
#3
| |||
| |||
|
|
Rick Altman wrote: I am attempting to create a simple display of a person's age from his or her birthdate. I want the display to be in the form of 17y 5m and I am running into difficulty. Here is the formula as I have devised it, with Birthdate being a manually-entered date: Let (Age=((Get(CurrentDate)-Birthdate)/365); Int(Left(Age;2)) & "y " & Int(Right(Round(Age;1);1)*(12/10)) & "m") //This long function does the following: //1. Defines a variable that is a person's age, based on Birthdate //2. Pulls out the first two digits as the year //3. Pulls out the last digit and converts it from decimal to month The conversion to y/m display fails with various dates. For instance, if you were to enter "8/1/03", the display would return 2y 2m. If anyone knows why this is happening, or knows of a better formula for accomplishing this task, I would appreciate hearing from you. Rick A. Pleasanton, CA Take a look at this Custom Functon: http://www.briandunning.com/filemake...l.php?fn_id=57. Custom Functions are specifically a Developer thing, but there's nothing stopping you from using a CF as a calculation. It doesn't do precisely what you desribed, but it comes real close. You might be able to adjust it to your needs. Matt |
#4
| |||
| |||
|
|
I am attempting to create a simple display of a person's age from his or her birthdate. I want the display to be in the form of 17y 5m and I am running into difficulty. Here is the formula as I have devised it, with Birthdate being a manually-entered date: Let (Age=((Get(CurrentDate)-Birthdate)/365); Int(Left(Age;2)) & "y " & Int(Right(Round(Age;1);1)*(12/10)) & "m") //This long function does the following: //1. Defines a variable that is a person's age, based on Birthdate //2. Pulls out the first two digits as the year //3. Pulls out the last digit and converts it from decimal to month The conversion to y/m display fails with various dates. For instance, if you were to enter "8/1/03", the display would return 2y 2m. If anyone knows why this is happening, or knows of a better formula for accomplishing this task, I would appreciate hearing from you. Rick A. Pleasanton, CA |
#5
| |||
| |||
|
|
Maybe I'm missing something here, but this simple calculation has always seemed to work for me where Birthdate would be the name of the field containing the person's birthday date. The calculation result should be Number. Calculation Field Age= Year(Today) - Year(Birthdate) - If(Today< Date(Month(Birthdate), Day(Birthdate), Year(Today)),1,0) Of course in v7 you would replace the Today function with the Get(CurrentDate) function thus: Calculation Field Age= Year(Get(CurrentDate)) - Year(Birthdate) - If(Get(CurrentDate) Date(Month(Birthdate), Day(Birthdate), Year(Get(CurrentDate))),1,0) Does anyone know of a reason why this would not do the trick or why this should not be used? I would like to hear some feedback. Al "Rick Altman" <rick.a (AT) NOSPAMaltman (DOT) com> wrote in message news:7-qdnci5NpWj_3PfRVn-uA (AT) comcast (DOT) com... I am attempting to create a simple display of a person's age from his or her birthdate. I want the display to be in the form of 17y 5m and I am running into difficulty. Here is the formula as I have devised it, with Birthdate being a manually-entered date: Let (Age=((Get(CurrentDate)-Birthdate)/365); Int(Left(Age;2)) & "y " & Int(Right(Round(Age;1);1)*(12/10)) & "m") //This long function does the following: //1. Defines a variable that is a person's age, based on Birthdate //2. Pulls out the first two digits as the year //3. Pulls out the last digit and converts it from decimal to month The conversion to y/m display fails with various dates. For instance, if you were to enter "8/1/03", the display would return 2y 2m. If anyone knows why this is happening, or knows of a better formula for accomplishing this task, I would appreciate hearing from you. Rick A. Pleasanton, CA |
#6
| |||
| |||
|
|
Maybe I'm missing something here, but this simple calculation has always seemed to work for me where Birthdate would be the name of the field containing the person's birthday date. The calculation result should be Number. Calculation Field Age= Year(Today) - Year(Birthdate) - If(Today< Date(Month(Birthdate), Day(Birthdate), Year(Today)),1,0) Of course in v7 you would replace the Today function with the Get(CurrentDate) function thus: Calculation Field Age= Year(Get(CurrentDate)) - Year(Birthdate) - If(Get(CurrentDate) Date(Month(Birthdate), Day(Birthdate), Year(Get(CurrentDate))),1,0) |
|
Does anyone know of a reason why this would not do the trick or why this should not be used? I would like to hear some feedback. |
![]() |
| Thread Tools | |
| Display Modes | |
| |