Ages and durations with DATEDIF

1 / 5

Work out each person's whole months of service on F1, 2 Aug 2026.

keyboard Typing formulas is easiest on a computer with a keyboard.

A1
ABCDEFG
1NameStart dateMonths of serviceAs at2 Aug 2026
2Isla3 Feb 2017
3Grace2 Aug 2018
4Zoe22 Jul 2020
5Quinn28 Feb 2020
6Amara7 Aug 2019
7Kofi31 Jul 2014
8Felix29 May 2021
9
10
11
12
start date
months of service
Type to enter a value or a formula starting with =. F2 edits, F4 adds $ to a reference.
Study notes

How DATEDIF works

  • What does DATEDIF do?

    It counts the whole years, months or days between two dates. The start date goes first:

    =DATEDIF(B2,$F$1,"Y")

  • Which units are there?

    • "Y": whole years, for ages and years of service.
    • "M": whole months.
    • "D": days, the same as subtracting.
    • "YM": months left over after the whole years, so you can write "35 years, 4 months".
    • "MD" and "YD": days ignoring months, or ignoring years. "MD" can give odd results at month ends, so avoid it.
  • Why not divide by 365?

    =(F1-B2)/365 drifts because of leap years and gives fractions, so someone the day before their birthday can come out a year older. YEAR(F1)-YEAR(B2) is wrong for everyone whose birthday hasn't come yet this year. DATEDIF counts the way people do.

  • Why isn't it in Excel's function list?

    DATEDIF came from Lotus 1-2-3 and Microsoft never documented it fully, so Excel doesn't suggest it as you type. It works in every version, and in Google Sheets.

  • What about today's age?

    Use TODAY() as the end date: =DATEDIF(B2,TODAY(),"Y"). Here F1 holds a fixed date so the answers don't change from day to day.

Know someone fighting with a spreadsheet? Send them this page.