Convert number of Days to Year/Month/Day

rbobcat1

New Member
Joined
Dec 19, 2011
Messages
19
Office Version
  1. 365
Platform
  1. Windows
Which is correct?
4202 Days, have always used the DATEDIF functions and came across another but it doesn't add up.

The DATDIF returns 4202 days to 11 years 6 months 3 days
[=DATEDIF(0,D11,"y")&" years " &DATEDIF(0,D11,"ym")&" months "&DATEDIF(0,D11,"md")&" days"]

But the below returns 4202 to 11 Years, 6 Months, 7 Days
[=INT(D11/365)&" Years, "&INT(MOD(D11,365)/30)&" Months, "&D11-((INT(D11/365)*365)+(INT(MOD(D11,365)/30)*30))&" Days"]

which one is right?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I would say the first one as the second doesn't take into account leap years or months which have more/less than 30 days.
 
Upvote 0

Forum statistics

Threads
1,215,510
Messages
6,125,234
Members
449,216
Latest member
biglake87

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