Years and months of service as text
PremiumIn C2, show the service from A2 to B2 as "6 years, 8 months". Join DATEDIF with "y" for the whole years, the text " years, ", DATEDIF with "ym" for the months left over and " months".
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Hired | Date | Service | |||
| 2 | Jun 15, 2018 | Mar 1, 2025 | ||||
| 3 | ||||||
| 4 | ||||||
| 5 | ||||||
| 6 | ||||||
| 7 | ||||||
| 8 |
Premium lesson
Unlock DATEDIF and every other lesson
This is a premium lesson. Premium lets you solve it and every other lesson, take the timed mock tests, and earn certificates you can share on LinkedIn.
Next with premium:Week numbers and weekendsLoans: PMT and NPER
Need help?
Why this works
From Jun 15, 2018 to Mar 1, 2025 is 6 whole years, which DATEDIF counts with "y". After Jun 15, 2024 there are 8 whole months to Feb 15, 2025, and "ym" counts those. The & joins both numbers with the text around them into one string.
Common mistake: Using "m" for the months. That counts all 80 months since the hire date, not the 8 after the last whole year.
The answer
- C2
=DATEDIF(A2,B2,"y")&" years, "&DATEDIF(A2,B2,"ym")&" months"
Join two DATEDIFs, =DATEDIF(A2,B2,"y")&" years, "&DATEDIF(A2,B2,"ym")&" months". "ym" gives the months after the whole years.