Tuesday, June 23, 2009

Calculate age in sharepoint list

Hi All,

i started trying to answer a question in mocrosoft forums which has gone a long way today and this is my third editing of the post.

How to calculate age in a sharepoint list with only date of birth available.

it can be done with the formula listed below :

=FLOOR((DATEDIF(DOB,Todaydate,"d")-(ROUND(((YEAR(Todaydate))-YEAR(DOB))/4,0)))/365,1)

Now i will explain what the fields are:

DOB- date of birth Field in the sharepoint list.
Todaysdate - gives you the date today but need to carry difficult step to get it. you cannot get todays date directly anywhere in sharepoint list, thats sure.

i got it via, the steps given at :

http://abstractspaces.wordpress.com/2008/05/19/use-today-and-me-in-calculated-column/

now what the formula does :

First it takes the difference between todays date and DOB. then substracts the no of leap years from it, divide it by 365 and took a round value.

Cheers!!!

2 comments:

srinivasu dandamudi said...

Thanks, it's working fine to me,thank for sharing

Unknown said...

Its says
The expression is not a node-set