#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 367
Default If statment

I am trying to write and if statment to include only 2001 dates. However, I
have dates both in 2000 and 2002. I tried the writing the following statment
and excel keeps giving me an error:

=IF(Date Field=1/1/2000 AND <1/1/2002, TRUE, FALSE)

Apparently excel doesn't like the and part. How can I go about getting
around this or writing the formula with a new word or character that excel
will accept?

Thanks,

jason
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default If statment

One way with the date in A1:

=and(a1=date(2001,1,1),a1<=date(2001,12,31)

or
=year(a1)=2001

You don't need the If's for either of these two formulas. These return true or
false by themselves.



Jason wrote:

I am trying to write and if statment to include only 2001 dates. However, I
have dates both in 2000 and 2002. I tried the writing the following statment
and excel keeps giving me an error:

=IF(Date Field=1/1/2000 AND <1/1/2002, TRUE, FALSE)

Apparently excel doesn't like the and part. How can I go about getting
around this or writing the formula with a new word or character that excel
will accept?

Thanks,

jason


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,345
Default If statment

=IF(AND(Date Field=DATE(2000,1,1),Date Field<DATE(2001,1,1)),TRUE,FALSE)

This assumes that what are calling Date Field is a single cell. If you mean
a range of dates called Date_Field, (you cannot have spaces in a defined
name), then use:

=SUMPRODUCT((Date_Field=DATE(2000,1,1))*(Date_Fie ld<DATE(2002,1,1)))

Which will count the number of date cells that fall within your required
range.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Jason" wrote in message
...
I am trying to write and if statment to include only 2001 dates. However,
I
have dates both in 2000 and 2002. I tried the writing the following
statment
and excel keeps giving me an error:

=IF(Date Field=1/1/2000 AND <1/1/2002, TRUE, FALSE)

Apparently excel doesn't like the and part. How can I go about getting
around this or writing the formula with a new word or character that excel
will accept?

Thanks,

jason



  #4   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 594
Default If statment

=IF(AND(A1=36526,A1<37257),TRUE,FALSE)

Vaya con Dios,
Chuck, CABGx3



"Jason" wrote in message
...
I am trying to write and if statment to include only 2001 dates. However,

I
have dates both in 2000 and 2002. I tried the writing the following

statment
and excel keeps giving me an error:

=IF(Date Field=1/1/2000 AND <1/1/2002, TRUE, FALSE)

Apparently excel doesn't like the and part. How can I go about getting
around this or writing the formula with a new word or character that excel
will accept?

Thanks,

jason



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
if statment Dreamstar_1961 Excel Worksheet Functions 5 April 17th 07 01:30 PM
If statment if its possible. atb Excel Discussion (Misc queries) 2 October 17th 06 05:50 PM
Something is wrong with this IF statment bastien86 Excel Worksheet Functions 2 August 3rd 06 05:39 PM
How do I use 'And' or "Or" in an If statment wmurphyjr Excel Worksheet Functions 3 May 4th 05 11:46 AM
If statment helpdesk genie Excel Worksheet Functions 2 January 12th 05 03:23 AM


All times are GMT +1. The time now is 07:11 AM.

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

About Us

"It's about Microsoft Excel"