calculate age in google sheets

Age Calculator

Calculating age is a common task, whether for personal use, data analysis, or project management. Google Sheets offers powerful functions to help you compute age with precision. This guide will walk you through the primary methods, common pitfalls, and best practices for calculating age in Google Sheets.

The DATEDIF Function: Your Go-To for Age Calculation

The most robust and widely used function for calculating the difference between two dates in Google Sheets (and Excel) is DATEDIF. This function is a bit of a hidden gem, as it doesn't appear in the function list, but it's incredibly powerful for age calculations.

Syntax of DATEDIF

=DATEDIF(start_date, end_date, unit)
  • start_date: The earlier date (e.g., birthdate).
  • end_date: The later date (e.g., today's date, or a specific calculation date).
  • unit: Specifies the type of information you want returned.

Understanding the 'Unit' Parameter

The unit parameter is crucial for getting the specific age component you need:

  • "Y": Returns the number of complete years between the two dates.
  • "M": Returns the number of complete months between the two dates.
  • "D": Returns the number of days between the two dates.
  • "YM": Returns the number of complete months after subtracting complete years. This is useful for getting the "months" part of an age (e.g., 30 years and 6 months).
  • "MD": Returns the number of complete days after subtracting complete years and months. This gives you the "days" part of an age.
  • "YD": Returns the number of days after subtracting complete years.

Step-by-Step: Calculate Age in Years, Months, and Days

1. Set Up Your Data

Let's assume you have a birthdate in cell A2. You want to calculate the age as of today's date.

  • In cell A1, type "Birthdate".
  • In cell A2, enter a birthdate (e.g., 1990-05-15).
  • In cell B1, type "Today's Date".
  • In cell B2, enter =TODAY(). This function automatically updates to the current date.

2. Calculate Age in Full Years

To get the age in full years, use the "Y" unit:

=DATEDIF(A2, B2, "Y")

This formula will return the number of complete years that have passed since the birthdate in A2 up to the date in B2.

3. Calculate Remaining Months

To find out how many full months have passed since the last birthday, use the "YM" unit:

=DATEDIF(A2, B2, "YM")

This will give you the number of months, excluding the full years already counted.

4. Calculate Remaining Days

To get the number of days that have passed since the last full month of the current age, use the "MD" unit:

=DATEDIF(A2, B2, "MD")

This provides the remaining days, completing the age calculation.

5. Combine for a Full Age String

You can combine these into a single, readable string using the & operator for concatenation:

=DATEDIF(A2, B2, "Y") & " years, " & DATEDIF(A2, B2, "YM") & " months, and " & DATEDIF(A2, B2, "MD") & " days"

This will output a result like: "33 years, 9 months, and 2 days".

Alternative: Using YEARFRAC for Decimal Age

Sometimes, you might need age as a decimal number, for example, for financial calculations or statistical analysis. The YEARFRAC function is perfect for this.

Syntax of YEARFRAC

=YEARFRAC(start_date, end_date, [day_count_convention])
  • start_date: The birthdate.
  • end_date: The calculation date.
  • day_count_convention (optional): Determines how the year is calculated. Common options include 0 (US (NASD) 30/360), 1 (Actual/Actual), 2 (Actual/360), 3 (Actual/365), 4 (European 30/360). For general purposes, 1 (Actual/Actual) is often preferred for accuracy in age calculations.

Example with YEARFRAC

=YEARFRAC(A2, B2, 1)

This would return a value like 33.78, indicating 33 full years and approximately 0.78 of the current year.

Common Pitfalls and Tips

  • Date Formatting: Ensure your dates are entered in a format Google Sheets recognizes. Using the date picker or a consistent format like YYYY-MM-DD is best.
  • TODAY() vs. a Fixed Date: If you use TODAY(), your age calculation will update daily. If you need a static age as of a particular past or future date, enter that date manually or reference a cell containing it.
  • DATEDIF Not Showing in Function List: Don't worry, this is normal. Just type it out, and it will work.
  • Error Messages: If you get #NUM! or #VALUE!, check that your start date is indeed earlier than your end date, and that your cells contain valid dates.

Quick Age Calculator

Use our interactive age calculator above to quickly determine age in years, months, and days between any two dates without needing to open Google Sheets!