Suggestions on DATEDIF formula

spectraflame

Well-known Member
Joined
Dec 18, 2002
Messages
829
Office Version
  1. 365
Platform
  1. Windows
I need to calculate age based on DOB and display it in Years, Months, Day. I am using this formula: =IF(DATEDIF(D2,NOW(),"Y")>0,DATEDIF(D2,NOW(),"Y")& " YEARS","")&IF(AND(DATEDIF(D2,NOW(),"Y")>0,DATEDIF(D2,NOW(),"YM")>0),", ","")&IF(DATEDIF(D2,NOW(),"YM")>0,DATEDIF(D2,NOW(),"YM")&" MONTHS","")&IF(AND(DATEDIF(D2,NOW(),"YM")>0,DATEDIF(D2,NOW(),"MD")>0),", ","")&IF(DATEDIF(D2,NOW(),"MD")>0,DATEDIF(D2,NOW(),"MD")&" DAYS","")

I am also using the same formula to calculate the years of service an employee has. Again, this works as desired.

Our retirement eligibility is based on age + years of service. HR would like to combine the data to show retirement status in years, months, and days.

I am just not able to figure out a simple method. Any suggestions?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Try putting the following in cell D2: = Date_Of_Birth + Start_Of_Service - NOW()
DOB = 1/1/974, START_DATE = 06/17/2022, result is 19327.35 or 52 Years, 11 Months, 29 days when formatted at YY,MM,DD. Thinking it should be 49 years of age based on today, 21 years of service based on today so the total years would be 70.
 
Upvote 0
For having 21 years of service, the start date should be no later than 7/19/2002.

Let's assume you have:
- a DOB of 1/1/1974 in cell B2;
- a start date of 6/17/2002 in cell C2;
- =B2+C2-NOW() in cell D2 (evaluates to 11/29/1952);
- your DATEDIF-based formula in cell E2 (evaluates to "70 YEARS, 7 MONTHS, 20 DAYS").
 
Upvote 0
maybe this can help for a portion of your question. I'm not sure about the time of service part, but will continue to look into it:

Book1
ABCDE
3
4Current Date2023-07-19
5
6DOBAge YearsAge MonthsAge Days
71974-01-2549524
81974-01-0149618
9
Sheet1
Cell Formulas
RangeFormula
C7:C8C7=DATEDIF(A7,$B$4,"Y")
D7:D8D7=DATEDIF(DATE(YEAR($B$4),MONTH(A7),DAY(A7)),$B$4,"M")
E7:E8E7=$B$4-DATE(YEAR($B$4),MONTH(A7)+D7,DAY(A7))
 
Upvote 0
For having 21 years of service, the start date should be no later than 7/19/2002.

Let's assume you have:
- a DOB of 1/1/1974 in cell B2;
- a start date of 6/17/2002 in cell C2;
- =B2+C2-NOW() in cell D2 (evaluates to 11/29/1952);
- your DATEDIF-based formula in cell E2 (evaluates to "70 YEARS, 7 MONTHS, 20 DAYS").
Sorry. Start would have been 2002
 
Upvote 0
I appreciate the detailed explanation. Again I was trying to make this more difficult than it had to be. I can just hide that cell that is doing the B2+C2-NOW() and that will return what HR is looking for. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,215,094
Messages
6,123,071
Members
449,092
Latest member
ipruravindra

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