DateDif -- nearest half date (x.5)

xtinct2

New Member
Joined
Nov 22, 2014
Messages
7
Hi --

I hope this is is a simple ask

what's the best way to calculate the difference b/w two dates (in # of months) with the result rounded to the nearest hals month.

So the difference between 4/15/2017 and 6/30/2017 would be 1.5 (instead of 2)

Thanks!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Why would it be 1.5? That's 2.5 months difference.

If 2.5 months is correct, will this get you close enough?

=MROUND((B1-A1)/30,0.5)
 
Upvote 0
You example i think should be 2.5 months not 1.5 months. In any case, you could use this.
=MROUND(DATEDIF("4/15/2017","6/28/2017","d")/30,0.5)
 
Upvote 0
Not sure how you get 1.5, should it not be 2.5? That is 2 2 months and 15 days.

The question then becomes do you want to round up from 15 or 14 or...?
=IF(DATEDIF(A1,B1,"y")=0,"",DATEDIF(A1,B1,"y")&" years ")&IF(DATEDIF(A1,B1,"ym")=0,"",DATEDIF(A1,B1,"ym")& " ")+IF(DATEDIF(A1,B1,"md")>14,1,0.5)
Change the bolded part as needed
 
Upvote 0
Not sure how you get 1.5, should it not be 2.5? That is 2 2 months and 15 days.

The question then becomes do you want to round up from 15 or 14 or...?
=IF(DATEDIF(A1,B1,"y")=0,"",DATEDIF(A1,B1,"y")&" years ")&IF(DATEDIF(A1,B1,"ym")=0,"",DATEDIF(A1,B1,"ym")& " ")+IF(DATEDIF(A1,B1,"md")>14,1,0.5)
Change the bolded part as needed
 
Upvote 0

Forum statistics

Threads
1,225,757
Messages
6,186,848
Members
453,379
Latest member
gabriellegonzalez

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