A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Discussion (Misc queries)
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

compare month and year in a date



 
 
Thread Tools Display Modes
  #1  
Old August 7th 09, 12:25 PM posted to microsoft.public.excel.misc
Afia
external usenet poster
 
Posts: 7
Default 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
Ads
  #2  
Old August 7th 09, 12:37 PM posted to microsoft.public.excel.misc
Ron Rosenfeld
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
  #3  
Old August 7th 09, 12:44 PM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 35,220
Default 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
  #4  
Old August 7th 09, 01:08 PM posted to microsoft.public.excel.misc
Afia
external usenet poster
 
Posts: 7
Default 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
>

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
count month when date is in day/month/year format ccKennedy Excel Worksheet Functions 6 April 30th 09 03:32 AM
Tell me which "season" (Month/Day through Month/Day) a date(Month/Day/Year) falls in (any year)??? misscrf Excel Discussion (Misc queries) 1 December 14th 07 03:59 PM
bar chart to compare month and year data whowhat Charts and Charting in Excel 0 August 22nd 07 08:30 PM
How to compare a date with financial year TUNGANA KURMA RAJU Excel Discussion (Misc queries) 3 March 31st 07 12:08 PM
Sort month/date/year data using month and date only SMW820 Excel Discussion (Misc queries) 6 June 22nd 06 05:14 PM


All times are GMT +1. The time now is 10:50 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 2004-2014 ExcelBanter.
The comments are property of their posters.