Date Functions
Advanced

DATEDIF Function

Calculate the difference between two dates using DATEDIF.

Task:

You need to calculate the age of employees based on their birthdates. Calculate the age in years in column C using the DATEDIF function, finding the difference between the birthdate in column B and the date 1/1/2026.

Learning Objectives:

  • Learn DATEDIF function
  • Understand date difference calculations
  • Practice age calculations
Hints

Solve without hints for +5 XP

Interactive Spreadsheet

The data in this exercise

This is the grid you start with. Cell references in the task — B6, C2 — point at the row numbers and column letters below.

ABC
1EmployeeBirthdateAge (Years)
2John1/15/1990
3Mary5/20/1985
4Tom12/31/2000
What this exercise teaches (contains the answer)

DATEDIF function is useful for calculating the difference between two dates in various units (days, months, years), which is common in HR, finance, or project management. In this task, you use a fixed date (1/1/2026) as the end date. Notice that John comes back 35, not 36: DATEDIF counts birthdays that have actually happened, and his falls on 15 January. Subtracting the years instead — 2026 minus 1990 — overstates the age of everyone born later in the year than your cut-off date, which is roughly half the people in any payroll.

Functions used here