Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / August 2007

Tip: Looking for answers? Try searching our database.

Comparing Dates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mlv - 06 Aug 2007 10:34 GMT
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-


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.