Convert Days to Months - Round Up

Robby19

Board Regular
Joined
Mar 19, 2018
Messages
227
So I have a Large Date - Small Date which outputs the amount of days in-between. What I need is to convert this number into a number of months and round that up.

For example, and output of 49 Days should equal 2 months. 15 Days should equal 1 month. So on and so forth, all the way to 48 months.

I tried using a DatedIF and INT =INT([@Days]/365)&" Y,"&INT(MOD([@Days],365)/30)&" M" however the INT does not round up to the next month if the days are in-between a month.

I hope this makes sense. Any help would be greatly appreciated.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
It's probably easier to do this with the original dates like this:


Book1
ABC
122/02/201816/04/20182
Sheet1
Cell Formulas
RangeFormula
C1=MONTH(B1)-MONTH(A1)+(YEAR(B1)-YEAR(A1))*12+IF(DAY(A1)B1),1,0)


WBD
 
Upvote 0
This is close, however I have noticed the following;

16 Apr 20 - 27 May 19 is coming out at 12. It should be 11. Since 27 May 19 plus 11 months would be 27 Apr 20, thus it becomes larger that the original date.
 
Upvote 0
Ermmm...


Book1
ABC
127/05/201916/04/202011
Sheet1
Cell Formulas
RangeFormula
C1=MONTH(B1)-MONTH(A1)+(YEAR(B1)-YEAR(A1))*12+IF(DAY(A1)B1),1,0)


WBD
 
Upvote 0
Got it working perfectly. Took me a second to understand the logic and write it for my report, but this is great. Thank you!
 
Upvote 0
Another approach would be to use a DAYS360 function which assumes 30 days in each month.

=TRUNC((DAYS360(A1,B8)/30)+MIN(MOD(DAYS360(A1,B1),30),1))
 
Upvote 0

Forum statistics

Threads
1,215,338
Messages
6,124,356
Members
449,155
Latest member
ravioli44

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