# Calculating Age - Message 30495.htm

Posted by Hamid H on September 16, 2001 4:37 AM

Paul,

You posted a formula re calculating age. can you please explain what the "y" "ym" and "md" inside the brackets do ?

Sorry if this is too obvious. I am fairly new to formulae.

Regards

Posted by Paul on September 16, 2001 6:06 AM

The formula came from pearson software consulting, at the time I posted it I could not remember where I got it from, or I would have gave him credit for it , it can be found at http://www.cpearson.com/excel/DateTimeWS.htm , I dont know precisely how it works but I think they are taking the year month and day out of the date, maybe somebody with more understanding of excel can answer it. Paul

Posted by Tom Urtis on September 16, 2001 11:38 AM

Hamid (and Paul if you don't mind me adding to the discussion):

The "y" returns the number of complete years in the time period.

The "ym" represents the difference between the months in the start date and end date.

The "md" is the difference between the days in the start date and end date.

To complete the concept (you didn't ask but here it is anyway), a "yd" would represent the difference in days between start date and end date.

Also as you might guess, the "m" and "d" are for the number of complete months and days respectively.

Hope this helps.

Tom Urtis