ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   If statment (https://www.excelbanter.com/excel-discussion-misc-queries/171570-if-statment.html)

Jason

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

Dave Peterson

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

Sandy Mann

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




CLR

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





All times are GMT +1. The time now is 07:43 PM.

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