Introduction
Excel date calculations become much more useful when you need to find the difference between dates, calculate future or previous months, or find the beginning and end of a month. In this chapter, you will practice DATEDIF, DAYS, EDATE, and EOMONTH with practical examples. These functions are commonly useful for calculating age, service duration, subscription periods, due dates, monthly reports, and billing dates. DATEDIF, DAYS, EDATE and EOMONTH Excel Practice questions with solutions to help you understand the concepts.
Question 1: Calculate the Number of Days Between Two Dates Using DAYS
Problem Statement
Find the number of days between the order date and delivery date.
Excel Data
| Order Date | Delivery Date | Days Taken |
|---|---|---|
| 01/09/2026 | 05/09/2026 | |
| 03/09/2026 | 10/09/2026 | |
| 10/09/2026 | 18/09/2026 | |
| 15/09/2026 | 20/09/2026 | |
| 20/09/2026 | 28/09/2026 |
Solution
In C2, enter:
=DAYS(B2,A2)
Copy the formula down.
Expected Output
| Order Date | Delivery Date | Days Taken |
|---|---|---|
| 01/09/2026 | 05/09/2026 | 4 |
| 03/09/2026 | 10/09/2026 | 7 |
| 10/09/2026 | 18/09/2026 | 8 |
| 15/09/2026 | 20/09/2026 | 5 |
| 20/09/2026 | 28/09/2026 | 8 |
DAYS(end_date,start_date) returns the number of days between two dates.
Question 2: Calculate Complete Years Using DATEDIF
Problem Statement
Calculate the completed years of service for each employee.
Excel Data
| Employee | Joining Date | As-of Date | Completed Years |
|---|---|---|---|
| Rahul | 15/06/2018 | 28/09/2026 | |
| Priya | 20/09/2020 | 28/09/2026 | |
| Amit | 10/01/2019 | 28/09/2026 | |
| Neha | 05/12/2021 | 28/09/2026 | |
| Arjun | 25/08/2017 | 28/09/2026 |
Solution
In D2, enter:
=DATEDIF(B2,C2,"Y")
Copy down.
Expected Output
| Employee | Joining Date | As-of Date | Completed Years |
|---|---|---|---|
| Rahul | 15/06/2018 | 28/09/2026 | 8 |
| Priya | 20/09/2020 | 28/09/2026 | 6 |
| Amit | 10/01/2019 | 28/09/2026 | 7 |
| Neha | 05/12/2021 | 28/09/2026 | 4 |
| Arjun | 25/08/2017 | 28/09/2026 | 9 |
"Y" tells DATEDIF to return completed years.
Question 3: Calculate Complete Months Using DATEDIF
Problem Statement
Calculate how many complete months have passed between the subscription start date and end date.
Excel Data
| Customer | Start Date | End Date | Complete Months |
|---|---|---|---|
| Rahul | 15/01/2026 | 15/09/2026 | |
| Priya | 10/02/2026 | 10/08/2026 | |
| Amit | 05/03/2026 | 20/09/2026 | |
| Neha | 01/04/2026 | 01/10/2026 | |
| Arjun | 12/05/2026 | 12/09/2026 |
Solution
In D2, enter:
=DATEDIF(B2,C2,"M")
Copy down.
Expected Output
| Customer | Start Date | End Date | Complete Months |
|---|---|---|---|
| Rahul | 15/01/2026 | 15/09/2026 | 8 |
| Priya | 10/02/2026 | 10/08/2026 | 6 |
| Amit | 05/03/2026 | 20/09/2026 | 6 |
| Neha | 01/04/2026 | 01/10/2026 | 6 |
| Arjun | 12/05/2026 | 12/09/2026 | 4 |
"M" returns completed months.
Question 4: Calculate Age Using DATEDIF
Problem Statement
Calculate each person’s completed age as of 28 September 2026.
Excel Data
| Name | Date of Birth | As-of Date | Age |
|---|---|---|---|
| Rahul | 15/06/2000 | 28/09/2026 | |
| Priya | 20/10/2002 | 28/09/2026 | |
| Amit | 10/01/1998 | 28/09/2026 | |
| Neha | 05/12/2005 | 28/09/2026 | |
| Arjun | 25/08/1995 | 28/09/2026 |
Solution
In D2, enter:
=DATEDIF(B2,C2,"Y")
Copy down.
Expected Output
| Name | Date of Birth | As-of Date | Age |
|---|---|---|---|
| Rahul | 15/06/2000 | 28/09/2026 | 26 |
| Priya | 20/10/2002 | 28/09/2026 | 23 |
| Amit | 10/01/1998 | 28/09/2026 | 28 |
| Neha | 05/12/2005 | 28/09/2026 | 20 |
| Arjun | 25/08/1995 | 28/09/2026 | 31 |
Question 5: Calculate Years and Remaining Months Using DATEDIF
Problem Statement
Calculate an employee’s completed years and remaining months of service.
For example:
8 years 3 months
Excel Data
| Employee | Joining Date | As-of Date | Service |
|---|---|---|---|
| Rahul | 15/06/2018 | 28/09/2026 | |
| Priya | 20/02/2020 | 28/09/2026 | |
| Amit | 10/01/2019 | 28/09/2026 | |
| Neha | 05/12/2021 | 28/09/2026 | |
| Arjun | 25/08/2017 | 28/09/2026 |
Solution
In D2, enter:
=DATEDIF(B2,C2,"Y")&" years "&DATEDIF(B2,C2,"YM")&" months"
Copy down.
Expected Output
| Employee | Joining Date | As-of Date | Service |
|---|---|---|---|
| Rahul | 15/06/2018 | 28/09/2026 | 8 years 3 months |
| Priya | 20/02/2020 | 28/09/2026 | 6 years 7 months |
| Amit | 10/01/2019 | 28/09/2026 | 7 years 8 months |
| Neha | 05/12/2021 | 28/09/2026 | 4 years 9 months |
| Arjun | 25/08/2017 | 28/09/2026 | 9 years 1 month |
"YM" returns the remaining complete months after completed years are removed.
Question 6: Calculate a Date Six Months Later Using EDATE
Problem Statement
A customer purchases a six-month subscription. Calculate the subscription end date based on the starting date.
Excel Data
| Customer | Start Date | Date After 6 Months |
|---|---|---|
| Rahul | 15/01/2026 | |
| Priya | 20/02/2026 | |
| Amit | 10/03/2026 | |
| Neha | 05/04/2026 | |
| Arjun | 12/05/2026 |
Solution
In C2, enter:
=EDATE(B2,6)
Copy down.
Expected Output
| Customer | Start Date | Date After 6 Months |
|---|---|---|
| Rahul | 15/01/2026 | 15/07/2026 |
| Priya | 20/02/2026 | 20/08/2026 |
| Amit | 10/03/2026 | 10/09/2026 |
| Neha | 05/04/2026 | 05/10/2026 |
| Arjun | 12/05/2026 | 12/11/2026 |
EDATE moves a date forward or backward by a specified number of months.
Question 7: Calculate a Date Three Months Earlier Using EDATE
Problem Statement
An invoice was generated on the dates below. Find the date exactly three months earlier.
Excel Data
| Invoice Date | Date 3 Months Earlier |
|---|---|
| 15/09/2026 | |
| 20/10/2026 | |
| 10/11/2026 | |
| 25/12/2026 | |
| 15/01/2027 |
Solution
In B2, enter:
=EDATE(A2,-3)
Copy down.
Expected Output
| Invoice Date | Date 3 Months Earlier |
|---|---|
| 15/09/2026 | 15/06/2026 |
| 20/10/2026 | 20/07/2026 |
| 10/11/2026 | 10/08/2026 |
| 25/12/2026 | 25/09/2026 |
| 15/01/2027 | 15/10/2026 |
A negative number tells EDATE to move backward.
Question 8: Find the End of the Current Month Using EOMONTH
Problem Statement
Find the last date of the month for each given date.
Excel Data
| Date | Month End |
|---|---|
| 05/01/2026 | |
| 15/02/2026 | |
| 20/04/2026 | |
| 10/09/2026 | |
| 25/11/2026 |
Solution
In B2, enter:
=EOMONTH(A2,0)
Copy down.
Expected Output
| Date | Month End |
|---|---|
| 05/01/2026 | 31/01/2026 |
| 15/02/2026 | 28/02/2026 |
| 20/04/2026 | 30/04/2026 |
| 10/09/2026 | 30/09/2026 |
| 25/11/2026 | 30/11/2026 |
The 0 means the current month.
Question 9: Find the End of the Next Month
Problem Statement
For each invoice date, find the last day of the following month.
Excel Data
| Invoice Date | End of Next Month |
|---|---|
| 15/01/2026 | |
| 20/02/2026 | |
| 10/03/2026 | |
| 05/09/2026 | |
| 25/11/2026 |
Solution
In B2, enter:
=EOMONTH(A2,1)
Copy down.
Expected Output
| Invoice Date | End of Next Month |
|---|---|
| 15/01/2026 | 28/02/2026 |
| 20/02/2026 | 31/03/2026 |
| 10/03/2026 | 30/04/2026 |
| 05/09/2026 | 31/10/2026 |
| 25/11/2026 | 31/12/2026 |
1 tells EOMONTH to move one month forward before finding the month’s final date.
Question 10: Create a Subscription Period Using EDATE and EOMONTH
Problem Statement
A company starts monthly subscriptions on different dates. For each subscription:
- Calculate the date six months later.
- Find the last day of that ending month.
Excel Data
| Customer | Start Date | Date After 6 Months | End of Ending Month |
|---|---|---|---|
| Rahul | 15/01/2026 | ||
| Priya | 20/02/2026 | ||
| Amit | 10/03/2026 | ||
| Neha | 05/04/2026 | ||
| Arjun | 12/05/2026 |
Solution
In C2, enter:
=EDATE(B2,6)
In D2, enter:
=EOMONTH(C2,0)
Copy both formulas down.
Expected Output
| Customer | Start Date | Date After 6 Months | End of Ending Month |
|---|---|---|---|
| Rahul | 15/01/2026 | 15/07/2026 | 31/07/2026 |
| Priya | 20/02/2026 | 20/08/2026 | 31/08/2026 |
| Amit | 10/03/2026 | 10/09/2026 | 30/09/2026 |
| Neha | 05/04/2026 | 05/10/2026 | 31/10/2026 |
| Arjun | 12/05/2026 | 12/11/2026 | 30/11/2026 |
This combines EDATE and EOMONTH to create a practical subscription-date calculation.
Key Takeaways
DATEDIFin excel calculates the difference between two dates in years, months, or days.DAYScalculates the number of days between two dates.EDATEmoves a date forward or backward by a specified number of months.EOMONTHin excel returns the last date of a month.DATEDIF(...,"Y")returns completed years.DATEDIF(...,"M")returns completed months.DATEDIF(...,"D")returns completed days.DATEDIF(...,"YM")returns remaining complete months after completed years.EDATE(A2,6)moves six months forward.EDATE(A2,-3)moves three months backward.EOMONTH(A2,0)returns the end of the current month.EOMONTH(A2,1)returns the end of the following month.- These functions are useful for age calculations, employee service periods, subscriptions, invoices, billing cycles, and monthly reports.
FAQs
1. What does DATEDIF do in Excel?
DATEDIF calculates the difference between two dates using different units such as years, months, and days.
For example:
=DATEDIF(A2,B2,"Y")
returns the number of completed years between the two dates.
2. Is DATEDIF available in Excel?
Yes. DATEDIF is supported in Excel, although it may not appear in Excel’s function autocomplete or function list in the same way as many other functions.
3. What is the difference between DATEDIF and DAYS?
DATEDIF can calculate differences in years, months, or days depending on the unit.
DAYS specifically returns the number of days between two dates.
=DAYS(B2,A2)
4. What does EDATE do?
EDATE moves a date by a specified number of months.
For example:
=EDATE(A2,6)
moves the date six months forward.
5. Can EDATE move a date backward?
Yes. Use a negative number of months.
=EDATE(A2,-3)
moves the date three months backward.
6. What does EOMONTH do?
EOMONTH returns the last date of a specified month.
=EOMONTH(A2,0)
returns the last day of the month containing the date in A2.
7. What is the difference between EDATE and EOMONTH?
EDATE returns the same day of the month after moving by a specified number of months.
EOMONTH returns the last day of the resulting month.
For example:
=EDATE(A2,1)
and
=EOMONTH(A2,1)
can return different dates.
8. How can I calculate someone’s age using DATEDIF?
If the date of birth is in A2 and the reference date is in B2:
=DATEDIF(A2,B2,"Y")
returns the completed age in years.
9. How can I calculate years and months together?
You can combine two DATEDIF calculations:
=DATEDIF(A2,B2,"Y")&" years "&DATEDIF(A2,B2,"YM")&" months"
For example, the result can be 8 years 3 months.
10. Why is EOMONTH useful in Excel reports?
EOMONTH is useful when you need monthly closing dates, billing periods, subscription end dates, monthly reports, or financial period calculations without manually determining whether a month has 28, 29, 30, or 31 days.
Written by Shubhranshu Shekhar, who has trained 20000+ students in coding.
