Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
John Brown
 
Posts: n/a
Default dates and if statement work on one sheet, not on another

Something's screwy. Two dates in different cells:

a1: 1/1/2003
b1: 10/29/2001

=a1-b1: 429
=b1-a1: -429
=if(a1<b1,1,0) 1

How can the last formula return a 1????
  #2   Report Post  
bj
 
Posts: n/a
Default

it returns a 0 for me

"John Brown" wrote:

Something's screwy. Two dates in different cells:

a1: 1/1/2003
b1: 10/29/2001

=a1-b1: 429
=b1-a1: -429
=if(a1<b1,1,0) 1

How can the last formula return a 1????

  #3   Report Post  
John Brown
 
Posts: n/a
Default

It's odd. I can get a 0 when I run the formula on cells in certain spaces of
the worksheet. But if I run it on other cells, I get a 1. Does format have
anything to do with this? I've made sure all have a cell format of date. It
is one with the asterisk, but I've tried with others and get the same
results. How can I get totally opposite results based on where I enter the
source data?

"bj" wrote:

it returns a 0 for me

"John Brown" wrote:

Something's screwy. Two dates in different cells:

a1: 1/1/2003
b1: 10/29/2001

=a1-b1: 429
=b1-a1: -429
=if(a1<b1,1,0) 1

How can the last formula return a 1????

  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

Your dates aren't really dates--they're text.

And excel will try to coerce anything that looks like a number (and a date is a
number) to a number when you use it in a calculation (a1-b1).

But it's comparing strings in that 3rd formula.


John Brown wrote:

Something's screwy. Two dates in different cells:

a1: 1/1/2003
b1: 10/29/2001

=a1-b1: 429
=b1-a1: -429
=if(a1<b1,1,0) 1

How can the last formula return a 1????


--

Dave Peterson
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
How Can I track changes in a Work Sheet? SiliconAlleyDude Excel Worksheet Functions 4 March 29th 05 10:17 AM
I really need help! Changing work period start dates JLyons Excel Worksheet Functions 0 February 16th 05 01:19 PM
When copying dates to another sheet the dates are different Kelly C Excel Worksheet Functions 1 January 12th 05 12:39 AM
I get wrong dates when i paste from a different sheet into a new s mmollat Excel Discussion (Misc queries) 2 January 6th 05 07:35 PM
How do I ensure dates inputted are during the work week? Jim Johnson Excel Worksheet Functions 3 October 29th 04 08:25 AM


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