Wrong math???

HeRoseInThree

Board Regular
Joined
Jan 11, 2018
Messages
103
My formula is :

=DATEDIF(O2,AL$1,"y")&" years, "&DATEDIF(O2,AL$1,"ym")&" months, "&O2-DATE(YEAR(O2),MONTH(O2),1)&" days"

Where O2 is the hire date and AL$1 is today()

The formula works, kinda. It isn't doing the math correctly. I have a person who started exactly a year ago and it is 2 weeks short...
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Welcome to the Board!

I think the problem is your day calculation. Can you explain why you wrote it this way:
Code:
&O2-DATE(YEAR(O2),MONTH(O2),1)&" days"
What that is doing is changing your hire date to the first day of the month they were hired, not the actual day.

I think this may be what you want:
Code:
=DATEDIF(O2,AL$1,"y")&" years, "&DATEDIF(O2,AL$1,"ym")&" months, "&DATEDIF(O2,AL$1,"md")&" days"
 
Upvote 0
You are welcome!

I hope it makes sense. If you notice, it is structured similarly to the first two parts (years and months).
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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