Bird
Raised Fist0
Google Sheetsspreadsheet~20 mins

DATEDIF for differences in Google Sheets - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
DATEDIF Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📊 Formula Result
intermediate
2:00remaining
Calculate full months between two dates
Given the start date in cell A1 as 2023-01-15 and the end date in cell B1 as 2023-04-10, which formula correctly calculates the number of full months between these dates using DATEDIF?
A=DATEDIF(A1, B1, "M")
B=DATEDIF(B1, A1, "M")
C=DATEDIF(A1, B1, "D")
D=DATEDIF(A1, B1, "Y")
Attempts:
2 left
💡 Hint
Remember that the third argument in DATEDIF specifies the unit: "M" for months, "D" for days, "Y" for years.
📊 Formula Result
intermediate
2:00remaining
Calculate days excluding years and months
If cell A1 contains 2022-12-01 and cell B1 contains 2023-02-15, which formula returns the number of days excluding full years and months between these dates?
A=DATEDIF(A1, B1, "MD")
B=DATEDIF(A1, B1, "YD")
C=DATEDIF(A1, B1, "YM")
D=DATEDIF(A1, B1, "D")
Attempts:
2 left
💡 Hint
The "MD" unit returns days ignoring months and years.
❓ Function Choice
advanced
2:30remaining
Find the formula for total years and leftover months
You want to calculate the total full years and leftover months between two dates in cells A1 and B1. Which pair of formulas correctly gives the years and leftover months respectively?
AYears: =DATEDIF(A1, B1, "Y") and Months: =DATEDIF(A1, B1, "MD")
BYears: =DATEDIF(A1, B1, "M") and Months: =DATEDIF(A1, B1, "MD")
CYears: =DATEDIF(A1, B1, "YD") and Months: =DATEDIF(A1, B1, "MD")
DYears: =DATEDIF(A1, B1, "Y") and Months: =DATEDIF(A1, B1, "YM")
Attempts:
2 left
💡 Hint
Use "Y" for full years and "YM" for leftover months ignoring years.
🎯 Scenario
advanced
2:00remaining
Identify the error in this DATEDIF formula
A user writes the formula =DATEDIF(B1, A1, "M") where A1 is the start date and B1 is the end date. What will happen when this formula is used?
AIt returns a negative number of months.
BIt returns a #NUM! error because the start date is after the end date.
CIt returns the number of full months between the two dates correctly.
DIt returns zero regardless of the dates.
Attempts:
2 left
💡 Hint
Check the order of dates in the DATEDIF function.
❓ data_analysis
expert
3:00remaining
Calculate total days excluding full years using DATEDIF
Given start date in A1 as 2019-05-20 and end date in B1 as 2023-08-15, which formula returns the total number of days excluding full years between these dates?
A=DATEDIF(A1, B1, "D") - (DATEDIF(A1, B1, "Y") * 365)
B=DATEDIF(A1, B1, "YM")
C=DATEDIF(A1, B1, "YD")
D=DATEDIF(A1, B1, "MD")
Attempts:
2 left
💡 Hint
The "YD" unit returns days ignoring years.

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