Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* If no Birthdate is known,
- leave the age blank */
- IF( ISBLANK( Birthdate ) , NULL ,
- /* Max age determined by the difference in the
- year number */
- YEAR( TODAY() ) - YEAR( Birthdate )
- /* Make an adjustment based on whether the
- birth month and day has come and passed
- in the current year */
- + IF( (
- /* Assuming there are 31 days in every
- month allows us to make a quick
- arithmetic comparison between two
- month-day-of-month combinations */
- MONTH( TODAY() ) * 31 + DAY( TODAY() ) )
- < ( MONTH( Birthdate ) * 31 + DAY( Birthdate )
- /* Make an adjustment to reach the real age
- by subtracting one from the max age when
- the person's birthday has not yet arrived
- in the current year */
- ) , -1 , 0 )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement