Bird
Raised Fist0
Google Sheetsspreadsheet~10 mins

DATEDIF for differences in Google Sheets - Cell-by-Cell Formula Trace

Choose your learning style10 modes available
Sample Data

This data shows a start date in A2 and an end date in B2. We want to find the difference between these two dates in years, months, and days using the DATEDIF function.

CellValue
A1Start Date
B1End Date
C1Difference (Years)
D1Difference (Months)
E1Difference (Days)
A22020-01-15
B22023-06-10
Formula Trace
=DATEDIF(A2, B2, "Y")
Step 1: DATEDIF("2020-01-15", "2023-06-10", "Y")
Cell Reference Map
    A           B           C           D           E
1 |Start Date|End Date  |Diff (Yrs)|Diff (Mths)|Diff (Days)|
2 |2020-01-15|2023-06-10|    3     |           |           |
The formula references cells A2 (start date) and B2 (end date) to calculate the difference in years.
Result
    A           B           C           D           E
1 |Start Date|End Date  |Diff (Yrs)|Diff (Mths)|Diff (Days)|
2 |2020-01-15|2023-06-10|    3     |           |           |
The result of the formula in cell C2 shows 3, meaning there are 3 complete years between the two dates.
Sheet Trace Quiz - 3 Questions
Test your understanding
What does the "Y" parameter in DATEDIF(A2, B2, "Y") mean?
ACalculate total days between dates
BCalculate complete months between dates
CCalculate complete years between dates
DCalculate difference ignoring years
Key Result
DATEDIF(start_date, end_date, unit) calculates the difference between two dates in specified units like years ("Y"), months ("M"), or days ("D").

Practice

(1/5)
1. What does the formula =DATEDIF(A1, B1, "D") calculate in Google Sheets?
easy
A. The number of days between the dates in A1 and B1
B. The number of months between the dates in A1 and B1
C. The number of years between the dates in A1 and B1
D. The sum of the dates in A1 and B1

Solution

  1. Step 1: Understand the DATEDIF function parameters

    DATEDIF takes two dates and a unit to calculate the difference.
  2. Step 2: Interpret the unit "D"

    "D" means the difference in days between the two dates.
  3. Final Answer:

    The number of days between the dates in A1 and B1 -> Option A
  4. Quick Check:

    DATEDIF with "D" returns days [OK]
Hint: Use "D" for days difference in DATEDIF [OK]
Common Mistakes:
  • Confusing "D" with months or years
  • Swapping the order of dates
  • Using incorrect unit letters
2. Which of the following is the correct syntax to calculate the number of complete months between dates in cells A2 and B2 using DATEDIF?
easy
A. =DATEDIF(B2, A2, "M")
B. =DATEDIF(A2, B2, M)
C. =DATEDIF(A2, B2, "Months")
D. =DATEDIF(A2, B2, "M")

Solution

  1. Step 1: Check the order of dates

    The earlier date must be first, so A2 then B2 is correct.
  2. Step 2: Verify the unit syntax

    The unit must be a text string in quotes, "M" for months is correct.
  3. Final Answer:

    =DATEDIF(A2, B2, "M") -> Option D
  4. Quick Check:

    Correct syntax uses quotes and earlier date first [OK]
Hint: Put earlier date first and use quotes around unit [OK]
Common Mistakes:
  • Swapping date order
  • Missing quotes around unit
  • Using full words instead of unit letters
3. Given cell A1 contains 2023-01-01 and B1 contains 2024-01-01, what is the result of =DATEDIF(A1, B1, "Y")?
medium
A. 0
B. 1
C. 12
D. 365

Solution

  1. Step 1: Identify the dates and unit

    A1 is Jan 1, 2023; B1 is Jan 1, 2024; unit "Y" means full years difference.
  2. Step 2: Calculate full years between the dates

    From Jan 1, 2023 to Jan 1, 2024 is exactly 1 full year.
  3. Final Answer:

    1 -> Option B
  4. Quick Check:

    DATEDIF with "Y" counts full years [OK]
Hint: Use "Y" for full years difference [OK]
Common Mistakes:
  • Confusing days or months with years
  • Expecting partial years to count
  • Using wrong date order
4. You entered =DATEDIF(A1, B1, "d") but get an error. What is the likely problem?
medium
A. The unit "d" should be uppercase "D"
B. The dates are in the wrong order
C. DATEDIF does not support "d" as a unit
D. The formula needs an extra argument

Solution

  1. Step 1: Check the unit case sensitivity

    DATEDIF units are case sensitive; "D" must be uppercase for days.
  2. Step 2: Confirm other syntax is correct

    Dates order and arguments are fine; only unit case causes error.
  3. Final Answer:

    The unit "d" should be uppercase "D" -> Option A
  4. Quick Check:

    Units are case sensitive in DATEDIF [OK]
Hint: Use uppercase letters for units in DATEDIF [OK]
Common Mistakes:
  • Using lowercase unit letters
  • Swapping date order
  • Adding extra arguments unnecessarily
5. You want to find the number of complete months and leftover days between two dates in A1 and B1. Which formula combination correctly calculates this?
hard
A. =DATEDIF(A1, B1, "M") + DATEDIF(A1, B1, "D")
B. =DATEDIF(A1, B1, "YM") & " months and " & DATEDIF(A1, B1, "D") & " days"
C. =DATEDIF(A1, B1, "M") & " months and " & DATEDIF(A1, B1, "MD") & " days"
D. =DATEDIF(A1, B1, "Y") & " years and " & DATEDIF(A1, B1, "MD") & " days"

Solution

  1. Step 1: Understand the units for months and leftover days

    "M" gives complete months; "MD" gives leftover days ignoring months and years.
  2. Step 2: Combine the two DATEDIF calls correctly

    Concatenate months and days with text for clear output.
  3. Final Answer:

    =DATEDIF(A1, B1, "M") & " months and " & DATEDIF(A1, B1, "MD") & " days" -> Option C
  4. Quick Check:

    Use "M" and "MD" together for months and leftover days [OK]
Hint: Use "M" plus "MD" to get months and leftover days [OK]
Common Mistakes:
  • Adding months and total days directly
  • Using "YM" which excludes years incorrectly
  • Mixing years with leftover days instead of months
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard