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 / February 2008

Tip: Looking for answers? Try searching our database.

test a range for value....

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim - 05 Feb 2008 15:45 GMT
Hi,

I have a column of dates, formatted as date dd/mm/yyyy. I would like to have
a formula in one cell that will evaluate the entire range to check if all
the dates are within a given year. If A1 is 01/01/2008, I can put
=year(a1)=2008 in B1 and return a true or false, but I can't seem to get it
to work for a range rather than just an individual cell.  Any help would be
greatly appreciated. TIA.

Jim
Pete_UK - 05 Feb 2008 15:55 GMT
Assuming your dates are in column A, with the search date 01/01/2008
in B1. This formula will count how many dates are not in the same year
as B1:

=SUMPRODUCT(--(YEAR(A1:A1000)=YEAR(B$1)))

I've assumed 1000 dates, so adjust this if you have more (but you
can't specify a complete column, unless you have XL2007).

Obviously, if this results in anything greater than zero, then you
have some dates in a different year, so you could amend it to:

=IF(SUMPRODUCT(--(YEAR(A1:A1000)=YEAR(B$1)))>0,FALSE,TRUE)

where TRUE means that every date is from the same year as B1.

Hope this helps.

Pete

> Hi,
>
[quoted text clipped - 6 lines]
>
> Jim
Don Guillett - 05 Feb 2008 16:03 GMT
=SUMPRODUCT((YEAR(F2:F22)<>2008)*(F2:F22>0))

Signature

Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com

> Hi,
>
[quoted text clipped - 9 lines]
>
> Jim
Dave Peterson - 05 Feb 2008 16:04 GMT
To check to see if A1:A10 contain dates in 2008:

=SUMPRODUCT(--(YEAR(A1:A10)=2008))=10
(you'll see true or false)

To check to see if the numeric (dates are numbers) entries in A1:A10 are all in
2008:

=SUMPRODUCT(--(YEAR(A1:A10)=2008))=count(a1:a10)
(you'll see true or false)

Adjust the ranges to match--but you can't use whole columns (except in xl2007).

=sumproduct() likes to work with numbers.  The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail here:
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html

> Hi,
>
[quoted text clipped - 6 lines]
>
> Jim

Signature

Dave Peterson

Jim - 05 Feb 2008 20:44 GMT
Thank you all very much.

> To check to see if A1:A10 contain dates in 2008:
>
[quoted text clipped - 28 lines]
> >
> > Jim
 
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.