View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Calculate Complete Months Between Two Dates

On Tue, 28 Oct 2008 14:48:00 -0700, Dave C
wrote:

I need to calculate leavers holiday entitlement where only the number of
fully completed months are included. A month where the start date is after
the first, or a month where the end date is prior to the last day of the
month are not included.

Example: Start Date: 15 January
End Date: 26 June
Full Months: 4 (Feb; Mar; Apr; May)

The start and end dates will be entered into cells;

Is there a definhed function to calculate this or what formula would I need?

Thanks, as always, for any assistance.

Dave



I think this will work for you:

=DATEDIF(IF(DAY(StartDt)<1,DATE(YEAR(StartDt),MON TH(StartDt)+1,1),StartDt),
IF(DAY(EndDt+1)<1,EndDt-DAY(EndDt)+1,EndDt+1),"m")

--ron