Calculate Age in Year in InfoPath Form in SharePoint 2013/2010


This InfoPath SharePoint tutorial explains how to calculate a person’s age (in years) given his/her date of birth in InfoPath 2010 in SharePoint 2010. It can be done without writing even a single line of code.


New to Office 365 SharePoint Online? Get Office 365 Enterprise E3 Subscription & Try out all the features

We only need to use rules, conditions, the today() function, the number() function, and the substring() function in InfoPath to calculate a person’s age given his/her date of birth.



Use the following procedure to do it.

1. Create a new Blank Form in InfoPath 2010.

infopath sharepoint Calculate Age in Year in InfoPath Form in SharePoint 2010
Calculate Age in Year in InfoPath Form in SharePoint 2010

2. Design the InfoPath form as below:

infopath sharepoint 2013infopath sharepoint Calculate Age in Year in InfoPath Form in SharePoint 2013
InfoPath SharePoint 2013 Calculate Age in Year in InfoPath Form in SharePoint 2013

3. Right-click the “Age” TextBox and make it read-only.

infopath sharepoint online Calculate Age in Year in InfoPath Form in SharePoint 2010
Calculate Age in Year in InfoPath Form in SharePoint 2010

4. Select the Date of Birth Control like below in InfoPath form.

infopath sharepoint 2016 Calculate Age in Year in InfoPath Form in SharePoint 2016
Calculate Age in Year in InfoPath Form in SharePoint 2016

5. Select the Manage rule from the ribbon in the InfoPath form.

infopath 2013 tutorial sharepoint Calculate Age in Year in InfoPath Form in SharePoint 2010
Calculate Age in Year in InfoPath Form in SharePoint 2010

6. Add a new Action rule in InfoPath form.

infopath 2013 tutorial sharepoint: Calculate Age in Year in InfoPath Form in SharePoint 2010
Calculate Age in Year in InfoPath Form in SharePoint 2010

7. In the Action select “Set A field’s Value”.

infopath 2013 tutorial sharepoint Calculate Age in Year in InfoPath Form in SharePoint 2010
Calculate Age in Year in InfoPath Form in SharePoint 2010

8. In the field select “Date of Birth”.

infopath 2013 tutorial sharepoint: Calculate Age in Year in InfoPath Form in SharePoint 2019
Calculate Age in Year in InfoPath Form in SharePoint 2019

9. In the value select the function icon.

infopath sharepoint 2010: Calculate Age in Year in InfoPath Form in SharePoint 2010
Calculate Age in Year in InfoPath Form in SharePoint 2010

10. Add the following formula:

number(substring(today(), 1, 4)) – number(substring(., 1, 4))


11. Finally, you will get the preview as below:

infopath sharepoint 2010 Calculate Age in Year in InfoPath Form in SharePoint 2010
Calculate Age in Year in InfoPath Form in SharePoint 2010

You may like following InfoPath SharePoint tutorial:

The age in years will be displayed depending on the selected Date of Birth in InfoPath form in SharePoint 2010.

Check out Best Alternative to InfoPath -> Try Now

FREE SHAREPOINT 2019 PDF

(Installation & Features)