Hi Richard,

If the dates are present in B10 and C10, use following formula:-

=(DAY(EOMONTH(B10,0))-DAY(B10)+1)/DAY(EOMONTH(B10,0))
+IF(ISERROR(DATEDIF(DATE(YEAR(B10),MONTH(B10)+1,DAY(B10)),DATE(YEAR(C10),MONTH(C10)-1,DAY(C10)),"m")),-1,DATEDIF(DATE(YEAR(B10),MONTH(B10)+1,DAY(B10)),DATE(YEAR(C10),MONTH(C10)-1,DAY(C10)),"m"))
+1+(DAY(EOMONTH(C10,0))-DAY(C10)+1)/DAY(EOMONTH(C10,0))

Also, I have tried achieving more accurate calculations as per below
scenario, shared by you:-

January 1, 2011 to February 14, 2011 would be 1.5 months -> would be
1.535714286
January 1, 2011 to February 15, 2011 would be 1.5335714  -> would be
1.5
January 1, 2011 to March 15, 2011 would be 2.483871           ->  would be
2.548387097

Let me know if this helps.

--
Thanks & Regards,

DILIP KUMAR PANDEY, mvp
                     MBA,B.Com(Hons),BCA
Mobile: +91 9810929744
dilipan...@gmail.com
dilipan...@yahoo.com
New Delhi - 62, India


On Jul 12, 1:55 pm, Richard <richard.m...@gmail.com> wrote:
> Hi All,
> I would appreciate a vba function that will calculation the number of months
> and fraction of a month between 2 dates.
>
> i.e.
> January 1, 2011 to February 14, 2011 would be 1.5 months
> January 1, 2011 to February 15, 2011 would be 1.5335714
> January 1, 2011 to March 15, 2011 would be 2.483871
>
> Thank you in advance
>
> Rich

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to