I need to check to see if the dates in two discrete cells are the same.
However, I only want to compare the month and the year, the day doesn't
matter.
For example:
A1 12/04/2007
B1 30/04/2007
C1 12/05/2007
D1 12/04/2006
IF(A1=B1,"TRUE","FALSE") result TRUE (the month and the year are
identical).
IF(A1=C1,"TRUE","FALSE") result FALSE (the months are different).
IF(A1=D1,"TRUE","FALSE") result FALSE (the years are different).
Is this easy to achieve?
Thanks

Signature
Mike
-Please remove 'safetycatch' from email address before firing off your
reply-
Pete_UK - 06 Aug 2007 11:54 GMT
Use MONTH and YEAR, as follows:
=IF(AND(MONTH(A1)=MONTH(B1),YEAR(A1)=YEAR(B1)),TRUE,FALSE)
or even just:
=AND(MONTH(A1)=MONTH(B1),YEAR(A1)=YEAR(B1))
Hope this helps.
Pete
> I need to check to see if the dates in two discrete cells are the same.
> However, I only want to compare the month and the year, the day doesn't
[quoted text clipped - 24 lines]
> -Please remove 'safetycatch' from email address before firing off your
> reply-
Harlan Grove - 06 Aug 2007 16:41 GMT
"Pete_UK" <pashurst@auditel.net> wrote...
>Use MONTH and YEAR, as follows:
>
[quoted text clipped - 3 lines]
>
>=AND(MONTH(A1)=MONTH(B1),YEAR(A1)=YEAR(B1))
...
Or just use DAY.
=(A1-DAY(A1)=B1-DAY(B1))
Dave Peterson - 06 Aug 2007 12:31 GMT
Another one:
=text(a1,"yyyymm")=text(b1,"yyyymm")
> I need to check to see if the dates in two discrete cells are the same.
> However, I only want to compare the month and the year, the day doesn't
[quoted text clipped - 24 lines]
> -Please remove 'safetycatch' from email address before firing off your
> reply-

Signature
Dave Peterson
Dana DeLouis - 07 Aug 2007 05:28 GMT
Maybe another option. This function is missing in my Help files of 2007,
but I think this is correct.
=DATEDIF(A1,B1,"m")=0

Signature
Dana DeLouis
Windows XP & Excel 2007
>I need to check to see if the dates in two discrete cells are the same.
>However, I only want to compare the month and the year, the day doesn't
[quoted text clipped - 20 lines]
>
> Thanks
mlv - 07 Aug 2007 09:23 GMT
> Maybe another option. This function is missing in my Help
> files of 2007, but I think this is correct.
>
> =DATEDIF(A1,B1,"m")=0
Hi Dana
Unfortunately this formula seems to fail if the date in Cell B1 is earlier
than the date in Cell A1 (which in my application, it might well be). The
result is a number error.

Signature
Mike
-Please remove 'safetycatch' from email address before firing off your
reply-