ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   compare month and year in a date (https://www.excelbanter.com/excel-discussion-misc-queries/239190-compare-month-year-date.html)

Afia

compare month and year in a date
 
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
--
Afia

Ron Rosenfeld

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

Dave Peterson

compare month and year in a date
 
Another:

=text(a1,"yyyymm")=text(b1,"yyyymm")



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
--
Afia


--

Dave Peterson

Afia

compare month and year in a date
 
Ron, Dave
Thank you!!!
--
Afia


"Dave Peterson" wrote:

Another:

=text(a1,"yyyymm")=text(b1,"yyyymm")



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
--
Afia


--

Dave Peterson



All times are GMT +1. The time now is 01:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com