Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.
Last reviewed:
=DATEDIF(A2,IF(B2="",TODAY(),B2),"Y")&" yr "&DATEDIF(A2,IF(B2="",TODAY(),B2),"YM")&" mo"Edit the grid or formula, then run it through a real spreadsheet engine — no signup.
Sample data — click any cell to edit
Working on a sheet you inherited? Run the Auditor on the whole file first — it flags every #REF!, #N/A, broken column pattern, and inconsistent formula in seconds, free, no signup.
Enter their termination date in column B. The IF(B2="",TODAY(),B2) portion uses TODAY() when B is blank (active employee) and the actual date when B has a value (former employee). The DATEDIF result is then frozen at their tenure on departure.
Yes — =DATEDIF(A2,TODAY(),"Y") returns only the count of completed years. Use "M" for total months, "D" for total days, "YM" for months in the current year, "MD" for days in the current month.
The start date is later than the end date — DATEDIF rejects that combination. Either fix the data (check for typos or swapped columns) or wrap with MIN/MAX: =DATEDIF(MIN(A2,B2),MAX(A2,B2),"Y").
DATEDIF "Y" returns whole completed years (an integer). YEARFRAC returns a decimal — 4.75 means 4 years and 9 months. Use DATEDIF for display, YEARFRAC for prorated calculations like bonuses or vesting.
DATEDIF only knows the calendar dates you give it. To exclude leave periods, store each leave's start/end and subtract their cumulative duration: =DATEDIF(A2,TODAY(),"D")-SUM(LeavesTable[Days]). Format the result as a number, divide by 365.25 for years.
Yes — concatenate three DATEDIFs: =DATEDIF(A2,TODAY(),"Y")&"y "&DATEDIF(A2,TODAY(),"YM")&"m "&DATEDIF(A2,TODAY(),"MD")&"d". Returns e.g. "4y 7m 12d".
Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.
Last reviewed: