What does the DATEDIF function do in Google Sheets?
DATEDIF calculates the difference between two dates in years, months, or days.
Click to reveal answer
beginner
Syntax of DATEDIF function?
DATEDIF(start_date, end_date, unit) where unit can be "Y", "M", "D", "MD", "YM", or "YD".
Click to reveal answer
beginner
What does the unit "Y" mean in DATEDIF?
It returns the number of complete years between the start and end dates.
Click to reveal answer
intermediate
How to get the number of months ignoring years using DATEDIF?
Use unit "YM" to get months difference ignoring years.
Click to reveal answer
intermediate
What happens if the start_date is after the end_date in DATEDIF?
DATEDIF returns a #NUM! error because start_date must be before end_date.
Click to reveal answer
Which DATEDIF unit returns the total days difference between two dates?
A"D"
B"MD"
C"YM"
D"Y"
✗ Incorrect
"D" returns the total number of days between the two dates.
What does the "MD" unit in DATEDIF calculate?
ADifference in complete months
BDifference in total days
CDifference in years
DDifference in days ignoring months and years
✗ Incorrect
"MD" returns the difference in days ignoring months and years.
If start_date is 2023-01-01 and end_date is 2024-01-01, what does DATEDIF with unit "Y" return?
A0
B12
C1
D365
✗ Incorrect
It returns 1 because there is one complete year between the dates.
Which unit would you use to find months difference ignoring years?
A"M"
B"YM"
C"YD"
D"MD"
✗ Incorrect
"YM" calculates months difference ignoring years.
What error occurs if start_date is after end_date in DATEDIF?
AReturns #NUM! error
BReturns negative number
CReturns 0
DReturns #VALUE! error
✗ Incorrect
DATEDIF returns a #NUM! error if start_date is after end_date.
Explain how to use DATEDIF to find the difference in years, months, and days between two dates.
Think about how each unit counts different parts of the date difference.
You got /4 concepts.
Describe the difference between the DATEDIF units "MD", "YM", and "YD".
Each unit ignores some parts of the date difference.
You got /3 concepts.
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
Step 1: Understand the DATEDIF function parameters
DATEDIF takes two dates and a unit to calculate the difference.
Step 2: Interpret the unit "D"
"D" means the difference in days between the two dates.
Final Answer:
The number of days between the dates in A1 and B1 -> Option A
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
Step 1: Check the order of dates
The earlier date must be first, so A2 then B2 is correct.
Step 2: Verify the unit syntax
The unit must be a text string in quotes, "M" for months is correct.
Final Answer:
=DATEDIF(A2, B2, "M") -> Option D
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
Step 1: Identify the dates and unit
A1 is Jan 1, 2023; B1 is Jan 1, 2024; unit "Y" means full years difference.
Step 2: Calculate full years between the dates
From Jan 1, 2023 to Jan 1, 2024 is exactly 1 full year.
Final Answer:
1 -> Option B
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
Step 1: Check the unit case sensitivity
DATEDIF units are case sensitive; "D" must be uppercase for days.
Step 2: Confirm other syntax is correct
Dates order and arguments are fine; only unit case causes error.
Final Answer:
The unit "d" should be uppercase "D" -> Option A
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
Step 1: Understand the units for months and leftover days
"M" gives complete months; "MD" gives leftover days ignoring months and years.
Step 2: Combine the two DATEDIF calls correctly
Concatenate months and days with text for clear output.
Final Answer:
=DATEDIF(A1, B1, "M") & " months and " & DATEDIF(A1, B1, "MD") & " days" -> Option C
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 unknownstrongwhile earning +1 Grip toward your certificate.