Excel is the most popular tool for tracking ages in large datasets. The most efficient way to do this is using the "hidden" DATEDIF function. Using the DATEDIF Formula The syntax is: =DATEDIF(start_date, end_date, unit) Cell containing the Date of Birth. TODAY(): Function to get the current date. "Y": Returns the difference in completed years. The Formula: =DATEDIF(A2, TODAY(), "Y") Getting More Detail (Years, Months, Days)
If it is your birth month but the current day is before your birthday, subtract 1 from your result. 📍 Example: Current Date: May 7, 2026 DOB: November 12, 1995 2026 - 1995 = 31 how to calculate age from date of birth
This calculates the fraction of a year between two dates. =INT(YEARFRAC(A2, TODAY())) Excel is the most popular tool for tracking
If you need an exact age like "25 Years, 3 Months, 2 Days," use this combined formula: TODAY(): Function to get the current date
Google Sheets uses the same logic as Excel but offers an additional, simpler function called YEARFRAC . Using YEARFRAC
If you are a developer, you shouldn't just subtract years. You must account for the calendar's progression.
from datetime import date def calculate_age(born): today = date.today() return today.year - born.year - ((today.month, today.day) < (born.month, born.day)) # Example usage: print(calculate_age(date(1995, 11, 12))) Use code with caution. Common Edge Cases Leap Years
Subscribe now to keep reading and get access to the full archive.