# If year of a date matches the year of any date in a range of dates, return true

1. ## If year of a date matches the year of any date in a range of dates, return true

Simple as the Title states: If year of a date matches the year of any date in a range of dates, return true. The only thing is, I'm trying to find a way to write a function that doesn't require me to individually compare the first date to each date in the range. For example:

=If(OR(YEAR(A1)=YEAR(C1),OR(YEAR(A1)=YEAR(C2),OR(YEAR(A1)=YEAR(C3),"TRUE","FALSE")

The closest I've gotten is:

=IF(YEAR(C1:C3)=YEAR(A1),"TRUE","FALSE")

But that doesn't work obviously… any help is appreciated!

2. ## Re: If year of a date matches the year of any date in a range of dates, return true

One way...

Data Range
 A B C 1 9/21/2008 ------ 6/11/2007 2 3/22/2010 3 5/23/2008 4 5 TRUE

This array formula** entered in A5:

=OR(YEAR(C1:C3)=YEAR(A1))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.

3. ## Re: If year of a date matches the year of any date in a range of dates, return true

Hi

Try this (not tested)
=IF(OR(YEAR(C1:C3)=YEAR(A1),"True","FALSE"))

4. ## Re: If year of a date matches the year of any date in a range of dates, return true

Originally Posted by José Augusto
Hi

Try this (not tested)
=IF(OR(YEAR(C1:C3)=YEAR(A1),"True","FALSE"))
That needs to be array entered.

There are currently 1 users browsing this thread. (0 members and 1 guests)