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

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.
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,214,984
Messages
6,122,601
Members
449,089
Latest member
Motoracer88

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