ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   dates and if statement work on one sheet, not on another (https://www.excelbanter.com/excel-worksheet-functions/44320-dates-if-statement-work-one-sheet-not-another.html)

John Brown

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????

bj

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????


John Brown

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????


Dave Peterson

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


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

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