Bird
Raised Fist0
Excelspreadsheet~20 mins

DATEDIF for date differences in Excel - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
DATEDIF Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📊 Formula Result
intermediate
2:00remaining
Calculate full years between two dates
You have a start date in cell A1 (01/01/2015) and an end date in cell B1 (01/01/2023). Which formula correctly calculates the number of full years between these two dates using DATEDIF?
A=DATEDIF(A1, B1, "D")
B=DATEDIF(A1, B1, "M")
C=DATEDIF(A1, B1, "Y")
D=DATEDIF(B1, A1, "Y")
Attempts:
2 left
💡 Hint
Remember, the third argument in DATEDIF specifies the unit: "Y" for years, "M" for months, "D" for days.
📊 Formula Result
intermediate
2:00remaining
Calculate months excluding years
Given a start date in A1 (15/01/2020) and an end date in B1 (10/06/2023), which formula returns the number of months after counting full years (i.e., months excluding full years) between the two dates?
A=DATEDIF(A1, B1, "YM")
B=DATEDIF(A1, B1, "M")
C=DATEDIF(B1, A1, "YM")
D=DATEDIF(A1, B1, "Y")*12
Attempts:
2 left
💡 Hint
Use the unit that counts months ignoring full years.
❓ Function Choice
advanced
2:00remaining
Choose the correct DATEDIF formula for total days difference
You want to find the total number of days between two dates in A1 and B1. Which formula correctly uses DATEDIF to get this total days difference?
A=DATEDIF(A1, B1, "D")
B=DATEDIF(B1, A1, "D")
C=DATEDIF(A1, B1, "MD")
D=DATEDIF(A1, B1, "Y")*365
Attempts:
2 left
💡 Hint
The unit "D" returns total days difference.
🎯 Scenario
advanced
3:00remaining
Calculate age in years, months, and days
You have a birthdate in cell A1 (10/03/1990) and today's date in B1 (25/06/2024). Which set of formulas correctly calculates the age as full years, remaining months, and remaining days?
AYears: =DATEDIF(B1, A1, "Y")<br>Months: =DATEDIF(B1, A1, "YM")<br>Days: =DATEDIF(B1, A1, "MD")
BYears: =DATEDIF(A1, B1, "Y")<br>Months: =DATEDIF(A1, B1, "YM")<br>Days: =DATEDIF(A1, B1, "MD")
CYears: =DATEDIF(A1, B1, "Y")<br>Months: =DATEDIF(A1, B1, "M")<br>Days: =DATEDIF(A1, B1, "D")
DYears: =DATEDIF(A1, B1, "Y")<br>Months: =DATEDIF(A1, B1, "MD")<br>Days: =DATEDIF(A1, B1, "YM")
Attempts:
2 left
💡 Hint
Use "Y" for years, "YM" for months ignoring years, and "MD" for days ignoring months and years.
📊 Formula Result
expert
2:00remaining
What error occurs with reversed dates in DATEDIF?
If cell A1 contains 01/01/2025 and B1 contains 01/01/2020, what happens when you use the formula =DATEDIF(A1, B1, "Y")?
A#VALUE! error
BReturns 5
CReturns -5
D#NUM! error
Attempts:
2 left
💡 Hint
DATEDIF requires the start date to be earlier than the end date.

Practice

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

Solution

  1. Step 1: Understand the DATEDIF function parameters

    The function takes a start date, an end date, and a unit to measure difference.
  2. Step 2: Interpret the unit "M"

    "M" means the difference in complete months between the two dates.
  3. Final Answer:

    The number of complete months between the dates in A1 and B1 -> Option D
  4. Quick Check:

    DATEDIF with "M" returns months [OK]
Hint: Use "M" to get months difference, not days or years [OK]
Common Mistakes:
  • Confusing "M" with days or years
  • Putting the later date first causing errors
  • Thinking it sums dates instead of difference
2. Which of the following is the correct syntax to find the number of days between dates in cells A2 and B2 using DATEDIF?
easy
A. =DATEDIF(B2, A2, "D")
B. =DATEDIF(A2, B2, "D")
C. =DATEDIF(A2, B2, "Days")
D. =DATEDIF(A2, B2, D)

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 parameter

    "D" in quotes is the correct unit for days; "Days" or D without quotes is invalid.
  3. Final Answer:

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

    Correct syntax uses "D" and earlier date first [OK]
Hint: Always put earlier date first and use "D" in quotes [OK]
Common Mistakes:
  • Swapping start and end dates
  • Using unit without quotes
  • Using incorrect unit names like "Days"
3. Given A1 = 2023-01-15 and B1 = 2024-03-10, what is the result of =DATEDIF(A1, B1, "Y")?
medium
A. 14
B. 2
C. 1
D. 0

Solution

  1. Step 1: Understand the dates and unit "Y"

    "Y" returns the number of complete years between the two dates.
  2. Step 2: Calculate complete years from 2023-01-15 to 2024-03-10

    Only one full year (2023-01-15 to 2024-01-15) has passed.
  3. Final Answer:

    1 -> Option C
  4. Quick Check:

    DATEDIF with "Y" counts full years only [OK]
Hint: DATEDIF "Y" counts full years, ignore partial months/days [OK]
Common Mistakes:
  • Counting partial years as full
  • Confusing "Y" with months or days
  • Misreading date formats
4. You entered =DATEDIF(A1, B1, "M") but got a #NUM! error. What is the most likely cause?
medium
A. The end date in B1 is earlier than the start date in A1
B. The unit "M" is not valid for DATEDIF
C. You forgot to put quotes around "M"
D. The dates are not formatted as text

Solution

  1. Step 1: Understand #NUM! error in DATEDIF

    This error happens if the start date is after the end date.
  2. Step 2: Check the order of dates in A1 and B1

    If B1 is earlier than A1, DATEDIF returns #NUM! error.
  3. Final Answer:

    The end date in B1 is earlier than the start date in A1 -> Option A
  4. Quick Check:

    #NUM! means start date > end date [OK]
Hint: Ensure start date is before end date to avoid #NUM! error [OK]
Common Mistakes:
  • Swapping dates causing negative difference
  • Using invalid units without quotes
  • Assuming date format causes error
5. You want to calculate the total number of months and days between two dates in A1 and B1, showing result as "X months and Y days". Which formula correctly does this?
hard
A. =DATEDIF(A1,B1,"M") & " months and " & DATEDIF(A1,B1,"MD") & " days"
B. =DATEDIF(A1,B1,"M") + DATEDIF(A1,B1,"D") & " months and days"
C. =DATEDIF(A1,B1,"YM") & " months and " & DATEDIF(A1,B1,"D") & " days"
D. =DATEDIF(A1,B1,"Y") & " months and " & DATEDIF(A1,B1,"MD") & " days"

Solution

  1. Step 1: Understand the units needed

    "M" gives total complete months, "MD" gives leftover days ignoring months and years.
  2. Step 2: Combine these with text to form the phrase

    Concatenate months, text, and days correctly using & and quotes.
  3. Final Answer:

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

    Use "M" and "MD" units combined with & for text [OK]
Hint: Use "M" and "MD" units with & to combine months and days [OK]
Common Mistakes:
  • Adding months and days instead of concatenating
  • Using wrong units like "YM" or "Y" for months
  • Forgetting quotes around text parts
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