Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 23
Default Date Between IF And Statement

Can someone help with my logic? I can't seem to figure this out.

I want it to say "2005" if the date is between 12/31/2004 and 01/01/2006. I
keep getting an error.

Here is my formula.

IF((AND(D2DATE(2004,12,31)),(D2<DATE(2006,1,1))), "2005","NO")
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,358
Default Date Between IF And Statement

You have too many parentheses:
IF(AND((D2DATE(2004,12,31),(D2<DATE(2006,1,1)),"2 005","NO")

but a better formula might be:
=IF(YEAR(D2)=2005,2005,"NO")
--
John C


"Paperback Writer" wrote:

Can someone help with my logic? I can't seem to figure this out.

I want it to say "2005" if the date is between 12/31/2004 and 01/01/2006. I
keep getting an error.

Here is my formula.

IF((AND(D2DATE(2004,12,31)),(D2<DATE(2006,1,1))), "2005","NO")

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 23
Default Date Between IF And Statement

I plug in the formula, and I still get a problem

IF(AND((D2DATE(2004,12,31),(D2<DATE(2006,1,1)),"2 005","NO")

Is this the corrected formula?

I can't use yours because it is year specific. I need variants that will
allow me to specify dates.

Thanks!!


"John C" wrote:

You have too many parentheses:
IF(AND((D2DATE(2004,12,31),(D2<DATE(2006,1,1)),"2 005","NO")

but a better formula might be:
=IF(YEAR(D2)=2005,2005,"NO")
--
John C


"Paperback Writer" wrote:

Can someone help with my logic? I can't seem to figure this out.

I want it to say "2005" if the date is between 12/31/2004 and 01/01/2006. I
keep getting an error.

Here is my formula.

IF((AND(D2DATE(2004,12,31)),(D2<DATE(2006,1,1))), "2005","NO")

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 23
Default Date Between IF And Statement

One more thing. The formula involves columns D and E.

REVISED

IF(AND((D2DATE(2004,12,31),(E2<DATE(2006,1,1)),"2 005","NO")

Still having problems. :(



"Paperback Writer" wrote:

I plug in the formula, and I still get a problem

IF(AND((D2DATE(2004,12,31),(D2<DATE(2006,1,1)),"2 005","NO")

Is this the corrected formula?

I can't use yours because it is year specific. I need variants that will
allow me to specify dates.

Thanks!!


"John C" wrote:

You have too many parentheses:
IF(AND((D2DATE(2004,12,31),(D2<DATE(2006,1,1)),"2 005","NO")

but a better formula might be:
=IF(YEAR(D2)=2005,2005,"NO")
--
John C


"Paperback Writer" wrote:

Can someone help with my logic? I can't seem to figure this out.

I want it to say "2005" if the date is between 12/31/2004 and 01/01/2006. I
keep getting an error.

Here is my formula.

IF((AND(D2DATE(2004,12,31)),(D2<DATE(2006,1,1))), "2005","NO")

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,358
Default Date Between IF And Statement

Try this correction: (I had untested prior).
=IF(AND(D2DATE(2004,12,31),D2<DATE(2006,1,1)),200 5,"NO")

This should work.

I can modify my other formula as well, say, for example, the year specific
that you are looking for is in cell H1, you could use this formula, and
modify the year as needed:
=IF(YEAR(D2)=$H$1,$H$1,"NO")
All you would need to do is type the year that you are checking for, in this
case, 2005.


--
John C


"Paperback Writer" wrote:

I plug in the formula, and I still get a problem

IF(AND((D2DATE(2004,12,31),(D2<DATE(2006,1,1)),"2 005","NO")

Is this the corrected formula?

I can't use yours because it is year specific. I need variants that will
allow me to specify dates.

Thanks!!


"John C" wrote:

You have too many parentheses:
IF(AND((D2DATE(2004,12,31),(D2<DATE(2006,1,1)),"2 005","NO")

but a better formula might be:
=IF(YEAR(D2)=2005,2005,"NO")
--
John C


"Paperback Writer" wrote:

Can someone help with my logic? I can't seem to figure this out.

I want it to say "2005" if the date is between 12/31/2004 and 01/01/2006. I
keep getting an error.

Here is my formula.

IF((AND(D2DATE(2004,12,31)),(D2<DATE(2006,1,1))), "2005","NO")



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default Date Between IF And Statement

You've still got your parentheses wrong. Go through the formula and check
which pairs match. Excel will usually colour the parentheses (while you are
editing the formula) to help you in this process.

Try =IF(AND(D2DATE(2004,12,31),D2<DATE(2006,1,1)),"20 05","NO")
--
David Biddulph

"Paperback Writer" wrote in
message ...
I plug in the formula, and I still get a problem

IF(AND((D2DATE(2004,12,31),(D2<DATE(2006,1,1)),"2 005","NO")

Is this the corrected formula?

I can't use yours because it is year specific. I need variants that will
allow me to specify dates.

Thanks!!


"John C" wrote:

You have too many parentheses:
IF(AND((D2DATE(2004,12,31),(D2<DATE(2006,1,1)),"2 005","NO")

but a better formula might be:
=IF(YEAR(D2)=2005,2005,"NO")
--
John C


"Paperback Writer" wrote:

Can someone help with my logic? I can't seem to figure this out.

I want it to say "2005" if the date is between 12/31/2004 and
01/01/2006. I
keep getting an error.

Here is my formula.

IF((AND(D2DATE(2004,12,31)),(D2<DATE(2006,1,1))), "2005","NO")



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,420
Default Date Between IF And Statement

It is no more specific than yours. Plug 2005 into a cell, and it is a simple
change

=IF(YEAR(D2)=$M$1,$M$1,"No")

--
__________________________________
HTH

Bob

"Paperback Writer" wrote in
message ...
I plug in the formula, and I still get a problem

IF(AND((D2DATE(2004,12,31),(D2<DATE(2006,1,1)),"2 005","NO")

Is this the corrected formula?

I can't use yours because it is year specific. I need variants that will
allow me to specify dates.

Thanks!!


"John C" wrote:

You have too many parentheses:
IF(AND((D2DATE(2004,12,31),(D2<DATE(2006,1,1)),"2 005","NO")

but a better formula might be:
=IF(YEAR(D2)=2005,2005,"NO")
--
John C


"Paperback Writer" wrote:

Can someone help with my logic? I can't seem to figure this out.

I want it to say "2005" if the date is between 12/31/2004 and
01/01/2006. I
keep getting an error.

Here is my formula.

IF((AND(D2DATE(2004,12,31)),(D2<DATE(2006,1,1))), "2005","NO")



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
Date Comparison and IF statement Holly Excel Worksheet Functions 4 January 19th 06 01:01 AM
how do I write the date in an if statement Susan Hayes Excel Worksheet Functions 1 August 23rd 05 09:29 PM
How can I use a date in an IF/AND statement? gsmith Excel Discussion (Misc queries) 2 July 13th 05 12:27 AM
If statement with date Tanya Excel Discussion (Misc queries) 4 May 20th 05 01:42 AM
Date in an IF statement LyndieBee Excel Worksheet Functions 2 March 8th 05 04:11 PM


All times are GMT +1. The time now is 10:33 PM.

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

About Us

"It's about Microsoft Excel"