View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default Calculate # of months if a date is given

"Fred Smith" wrote:
Try:
=datedif(a1,min(b1,date(year(a1),12,31)),"m")


Result is 0 for start 12/1/2010, end 1/1/2011. Shouldn't that be 1?

Result is 0 for start 10/31/2010, end 11/30/2010. Not clear what answer
"LP" would like in that case.

Result is 8 for start 3/2/2010, end 12/1/2010. As I noted, some people
might want 9. Not clear what "LP" wants.


----- original message -----

"Fred Smith" wrote in message
...
Try:

=datedif(a1,min(b1,date(year(a1),12,31)),"m")

Regards,
Fred.

"LP" wrote in message
...
I have 2 columns with date range. A1 is start date of 3/1/2010 and
B1 end date of 3/1/2011. Is there a way to show the number of months
ONLY in 2010? I realized the question has been asked before but I
believe it's to calculate the number of months between the 2 dates.
This is specific to the year I want. Thanks.