Calculate age on specific data

I'm trying to recreate an Excel sheet with XlsIO which was initially created with Excel.
Most columns I can figure out but I'm struggling with calculating the age on a specific date.

I open an existing xlsx-file as a template and in this template the date is set in cell D1
Next, I loop through a dataset and write data of persons starting at row 7.
Column F holds the DOB of the person, in column G I need to calculate his age in years.
In Excel this formula is used:  =DATEDIF(Start_Date, End_Date, Unit), making =DATEDIF(F7, D$1$, "y") in my example.
What is the XlsIO equivalent?

Thanks

5 Replies

AV Abirami Varadharajan Syncfusion Team September 6, 2017 01:10 PM UTC

Hi Paul, 
 
Thank you for contacting Syncfusion support. 
 
Currently, we don’t have support to calculate DATEDIF function. We don’t have immediate plans to implement this feature as Excel also calculates incorrect results under certain scenario. Please refer the following link. 
 
 
Please let us know if you have any concerns. 
 
Regards, 
Abirami 



PM Paul Meems September 7, 2017 08:28 AM UTC

Thanks for the response. I already anticipated and found another solution.

Leave the original formula in the template and just copy it to the new cells. Then it works fine.

I also need to change the formula to =GEH.GET.(($D$1-F7)/365) to get it to work.

Support provided a full working sample at 132506 



AV Abirami Varadharajan Syncfusion Team September 8, 2017 06:40 AM UTC

Hi Paul, 

Thank you for updating us. 

We are glad that your requirement is fulfilled. Please let us know if you need any further assistance. 

Regards, 
Abirami. 



SK Sam Konstas Smith October 27, 2025 06:24 PM UTC

Valuable!

You can also calculate age in XlsIO similarly to Excel by using the DateTime class in C#. For each person, read the DOB from column F, get the reference date from D1, and then subtract the year values while adjusting for whether the birthday has occurred yet this year. This approach allows you to dynamically compute ages, so you could easily include data like jay cinco age in your sheet without relying on Excel formulas directly.



GP Gowtham Ponraj Syncfusion Team October 28, 2025 07:05 AM UTC

Hi Sam,

Thank you for this suggestion.


Regards,
Gowtham.


Loader.
Up arrow icon