View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default compare month and year in a date

On Fri, 7 Aug 2009 04:25:01 -0700, Afia wrote:

I have 2 date columns and i need to compare the month and year only,

for example: column a = 31/12/2009 and column 2 is 12/12/2009, the result
should be true


=and(month(a1)=month(b1),year(a1)=year(b1))

or, less intuitive but shorter:

=(a1-day(a1))=(b1-day(b1))



--ron