Help on formula

TDD

New Member
Joined
May 6, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Need help on what formula to use to calculate the tenure of an employee from hire date in one cell and have that cell tenure count change once I put the resignation date of the employee in another cell
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi, not 100% sure of what you are after but try this. Start Date in B1, Resignation Date in B2. Enter the below formula in C1.
=IF(B2="",DATEDIF(B1,TODAY(),"y")&" years,"&DATEDIF(B1,TODAY(),"ym")&" months,"&DATEDIF(B1,TODAY(),"md")&" days",DATEDIF(B1,B2,"y")&" years,"&DATEDIF(B1,B2,"ym")&" months,"&DATEDIF(B1,B2,"md")&" days")
If no resignation, B2 is blank and tenure to today, otherwise to resignation date.
 
Upvote 0
an alternative to consider
=IF(B2="","",ROUND(YEARFRAC(B1,B2,1),1))

Review Excel's help for information on the functions.
 
Upvote 0
Hi, not 100% sure of what you are after but try this. Start Date in B1, Resignation Date in B2. Enter the below formula in C1.
=IF(B2="",DATEDIF(B1,TODAY(),"y")&" years,"&DATEDIF(B1,TODAY(),"ym")&" months,"&DATEDIF(B1,TODAY(),"md")&" days",DATEDIF(B1,B2,"y")&" years,"&DATEDIF(B1,B2,"ym")&" months,"&DATEDIF(B1,B2,"md")&" days")
If no resignation, B2 is blank and tenure to today, otherwise to resignation date.

Thanks!
 
Upvote 0
I wouldn't put implicit trust in the DATEDIF(B1,B2,"md")&" days" element of the formula, as it can generate negative numbers.
Example:-
Start date End date Generated Output
31/10/1985 01/03/2020 34 years, 4 months, -1 days

Microsoft are aware - DATEDIF function - they have a work around, which doesn't work too well either, particularly if the Start date is in a leap year.

This alternative seems to be more accurate than the current solutions offered, if a bit convoluted, but clearly would be better if Microsoft could come up with a 100% accurate formula :(
=DATEDIF(B1,B2,"y")&" years, " & DATEDIF(B1,B2,"ym")&" months, " & IF(DAY(B2)>=DAY(B1),DAY(B2)-DAY(B1),DAY(EOMONTH(B1, 0))-DAY(B1)+DAY(B2))&" days"
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top