Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Lynn
 
Posts: n/a
Default if statements & dates?

Is there a problem with using dates in IF statements? I'm trying to ask
Excel to record 0 if the date is 9/9/99, and if it's not 9/9/99 put in the
content of the cell:

=if(a1=9/9/99,0,a1)

It works for dates unless it's 9/9/99
Thanks
Lynn
  #2   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Mon, 19 Sep 2005 07:38:04 -0700, "Lynn"
wrote:

Is there a problem with using dates in IF statements? I'm trying to ask
Excel to record 0 if the date is 9/9/99, and if it's not 9/9/99 put in the
content of the cell:

=if(a1=9/9/99,0,a1)

It works for dates unless it's 9/9/99


Not really, with the syntax you've shown. When you omit the quotes in the IF
statement, Excel will interpret the value as requiring multiple divisions.

So use:

=if(a1="9/9/99",0,a1)

Better (as it will be less ambiguous):

=if(a1=date(99,9,9),0,a1)

Probably best, as it allows easy modification:

=if(a1=b1,0,a1)

With the date to be compared with in B1.


--ron
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
2 digit year in dates return 19xx not 20xx moranbo Excel Discussion (Misc queries) 1 September 7th 05 01:44 AM
Default Dates Sue Excel Discussion (Misc queries) 1 July 22nd 05 12:29 PM
Using dates for x-axis values as string instead of creating a scale cs_weirdo Charts and Charting in Excel 2 June 17th 05 12:20 AM
Formating Dates for production schedule dpl7579 Excel Discussion (Misc queries) 1 January 11th 05 08:43 PM
due dates Niki New Users to Excel 4 January 10th 05 04:11 PM


All times are GMT +1. The time now is 03:06 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"