Excel Age Formulas: Calculate Birthdate Age in Cells

Master how to calculate age from birthdates in Excel using DATEDIF and YEARFRAC. This guide covers practical examples, precision options, and common pitfalls to avoid.

XLS Library
XLS Library Team
·5 min read
Excel Age Formula - XLS Library
Quick AnswerDefinition

The standard Excel approach to determine age from a birthdate uses DATEDIF or YEARFRAC. For whole years, =DATEDIF(BirthDate, TODAY(), "Y"). For years, months, and days, combine DATEDIF parts like =DATEDIF(BirthDate, TODAY(), "Y") & " years, " & DATEDIF(BirthDate, TODAY(), "YM") & " months" and optionally use YEARFRAC for fractional ages. These formulas handle leap years and future dates, and you can wrap with IFERROR to manage invalid dates.

Understanding the excel formula for age and why you need it

Calculating age from a birthdate is a common data task in Excel dashboards, HR sheets, and analytics models. The excel formula for age is not just about a single number—it can drive eligibility checks, aging reports, and personalized communications. According to XLS Library, reliable age calculations start with proper date handling and clear rules for leap years, time zones, and invalid dates. In this section we outline the core ideas and set expectations before we dive into concrete formulas.

Excel Formula
=DATEDIF(A2, TODAY(), "Y")

This formula returns the number of full years between the birthdate in A2 and today. We’ll build from here: you’ll learn to expose months and days, handle errors, and compare ages across cohorts. The goal is a robust, maintainable solution you can copy into real worksheets.

Date math foundations: what Excel can do with dates

Excel stores dates as serial numbers; calculations with dates yield new dates or differences. We’ll show how functions like TODAY(), DATE(), and DATEVALUE() interact. The article uses example birthdates in column A and computed ages in column B. If your data uses text dates, first convert them to dates using DATEVALUE or Text to Columns. This foundation ensures your age calculations are reliable across datasets.

Excel Formula
=DATE(1990, 4, 15) ' creates a date value for April 15, 1990
Excel Formula
=TODAY() ' current date

This block demonstrates how to validate that a date is recognized by Excel and how to prepare data for reliable age calculations. You’ll want to ensure the birthdate cells are indeed dates; otherwise, the age formulas may return errors or nonsensical values. We'll revisit common pitfalls in later sections.

Age in years using DATEDIF

DATEDIF is a legacy compatibility function in Excel that still works reliably for calculating age. The standard pattern is =DATEDIF(birthdate, TODAY(), "Y"). It computes the number of full years between the two dates. For a simple column-lookup, place this in B2 and copy down.

Excel Formula
' Example usage =DATEDIF(A2, TODAY(), "Y") ' age in completed years

The next step shows how to extend this to months and days if you need more precision.

Age in years, months, and days with DATEDIF pieces

To break the age into years, months, and days, you combine multiple DATEDIF calls. This yields a friendlier, human-readable output. Example: years = DATEDIF(A2, TODAY(), "Y"); months = DATEDIF(A2, TODAY(), "YM"); days = DATEDIF(A2, TODAY(), "MD"). Then you can concatenate: =DATEDIF(A2, TODAY(), "Y") & " years, " & DATEDIF(A2, TODAY(), "YM") & " months, " & DATEDIF(A2, TODAY(), "MD") & " days".

Excel Formula
=DATEDIF(A2, TODAY(), "Y") & " years, " & DATEDIF(A2, TODAY(), "YM") & " months, " & DATEDIF(A2, TODAY(), "MD") & " days"

Alternative: you can use TEXT() with YEARFRAC for a more compact display, as shown next.

Fractional ages with YEARFRAC and rounding

YEARFRAC computes age as a decimal number of years. This is useful when you need precise age (e.g., 24.66 years). Use =YEARFRAC(birthdate, TODAY(), 1) for fractional years and adjust with ROUND or INT as needed.

Excel Formula
=YEARFRAC(A2, TODAY(), 1)
Excel Formula
=INT(YEARFRAC(A2, TODAY(), 1))

These options give you flexibility for dashboards, risk scoring, or eligibility rules that depend on age with precision. In the next block we’ll cover error handling to keep results clean even with irregular data.

Robustness: errors, leap years, and data quality

No dataset is perfect. You should guard age formulas with IFERROR to gracefully handle invalid dates. Also, ensure the birthdate column contains real dates, not strings. A simple pattern: =IFERROR(DATEDIF(A2, TODAY(), "Y"), "invalid date"). For more comprehensive validation, combine ISNUMBER(DATEVALUE()) checks before computing age.

Excel Formula
=IFERROR(DATEDIF(A2, TODAY(), "Y"), "invalid date")

If your data includes zero or future dates, you can clamp results: =IF(A2 > TODAY(), 0, DATEDIF(A2, TODAY(), "Y")).

Practical template: end-to-end example workbook

Suppose you have a small dataset:

  • A2:A6 birthdates: 1986-03-22, 1992-07-15, 2000-01-01, 1984-12-30, 1999-11-11
  • B2:B6 initial age formulas using =DATEDIF(A2, TODAY(), "Y")
  • C2:C6 optional growth: =YEARFRAC(A2, TODAY(), 1)
Excel Formula
' Age in years (full years) =B2 ' Fractional age in years =C2

This template helps you copy formulas across a sheet and reuse the layout for new cohorts. The result columns can feed charts and pivot tables. If you want to show age buckets (e.g., 0-9, 10-19), add a simple IF formula to group ages.

Steps

Estimated time: 15-30 minutes

  1. 1

    Prepare birthdate column

    Organize birthdates in a single column (e.g., A2:A100). Ensure cells are formatted as dates. This makes downstream calculations reliable.

    Tip: Use Data -> Text to Columns if dates are stored as text.
  2. 2

    Enter the base age formula

    In the adjacent column (e.g., B2), enter the age in completed years using =DATEDIF(A2, TODAY(), "Y").

    Tip: Use absolute TODAY() to keep it dynamic.
  3. 3

    Fill down the formula

    Drag the fill handle or double-click to apply to the rest of the rows. Verify results align with sample dates.

    Tip: Check a known date, e.g., a birthdate of today’s date will yield 0.
  4. 4

    Optional: show months and days

    Add: =DATEDIF(A2, TODAY(), "YM") & " months" & ":" & =DATEDIF(A2, TODAY(), "MD").

    Tip: This is a rough human-friendly age; adjust punctuation.
  5. 5

    Handle errors gracefully

    Wrap formulas with IFERROR to handle invalid dates.

    Tip: Example: =IFERROR(DATEDIF(A2, TODAY(), "Y"), "invalid date").
Pro Tip: Use YEARFRAC for fractional ages when you need precise age in decimals.
Warning: Be careful with leap years around Feb 29; verify with sample dates.
Note: Store birth dates as dates, not text, to avoid misinterpretation by Excel.

Prerequisites

Required

Optional

  • IFERROR for robust error handling (optional)
    Optional

Keyboard Shortcuts

ActionShortcut
CopyCopy birthdate or formulaCtrl+C
PastePaste results or formulasCtrl+V
Fill DownApply age formula to a columnCtrl+D

People Also Ask

What is the best formula to calculate age in years only?

For years only, use =DATEDIF(birthdate, TODAY(), "Y"). This returns the completed age in whole years.

Use DATEDIF with the Y unit to get full years.

How can I get age in years and months?

Combine DATEDIF parts, for example: =DATEDIF(birthdate, TODAY(), "Y") & " years, " & DATEDIF(birthdate, TODAY(), "YM") & " months".

Combine Y and YM to show years and months.

What about leap years?

Dates around February 29 are handled automatically by DATEDIF; verify with sample dates.

Excel handles leap years automatically in DATEDIF.

Can I use YEARFRAC for age?

Yes, use =YEARFRAC(birthdate, TODAY(), 1) for fractional years and adjust with ROUND or INT as needed.

YEARFRAC gives fractional ages.

How do I prevent errors from invalid dates?

Wrap with IFERROR, e.g., =IFERROR(DATEDIF(...), "invalid date").

IFERROR helps avoid errors on bad dates.

The Essentials

  • Use DATEDIF for straightforward age in years
  • YEARFRAC provides fractional ages
  • Combine DATEDIF components for full age in years, months, days
  • Wrap formulas in IFERROR for robustness

Related Articles