J
Jonathan Rynd
Does anybody know what algorithm Excel uses to compare strings with < and
For instance I just created the following table into A1:I9
'-100 '-10 '-1 '0 '00 '1 '10 '100
'-100
'-10
'-1
'0
'00
'1
'10
'100
Note I put a ' before each entry to force it to be a string. I also
could have formatted the cells as text.
Then I put =$A2<B$1 into B2, and filled down and right. I got this:
-100 -10 -1 0 00 1 10 100
-100 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
-10 TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE
-1 TRUE TRUE FALSE FALSE FALSE FALSE TRUE TRUE
0 TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE
00 TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE
1 TRUE TRUE TRUE FALSE FALSE FALSE TRUE TRUE
10 TRUE TRUE FALSE FALSE FALSE FALSE FALSE TRUE
100 TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
??? It looks like it is taking the absolute value of both sides of the <!
What is going on?
Then I tried this, again using the ' to force it to be strings:
-30 -20 -10 0 10 20 30
-30 FALSE FALSE FALSE FALSE FALSE FALSE FALSE
-20 TRUE FALSE FALSE FALSE FALSE FALSE TRUE
-10 TRUE TRUE FALSE FALSE FALSE TRUE TRUE
0 TRUE TRUE TRUE FALSE TRUE TRUE TRUE
10 TRUE TRUE TRUE FALSE FALSE TRUE TRUE
20 TRUE TRUE FALSE FALSE FALSE FALSE TRUE
30 TRUE FALSE FALSE FALSE FALSE FALSE FALSE
again, it looks like it's taking absolute values!
But it's not just about numbers; something similar happens with text too.
For instance I just created the following table into A1:I9
'-100 '-10 '-1 '0 '00 '1 '10 '100
'-100
'-10
'-1
'0
'00
'1
'10
'100
Note I put a ' before each entry to force it to be a string. I also
could have formatted the cells as text.
Then I put =$A2<B$1 into B2, and filled down and right. I got this:
-100 -10 -1 0 00 1 10 100
-100 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
-10 TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE
-1 TRUE TRUE FALSE FALSE FALSE FALSE TRUE TRUE
0 TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE
00 TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE
1 TRUE TRUE TRUE FALSE FALSE FALSE TRUE TRUE
10 TRUE TRUE FALSE FALSE FALSE FALSE FALSE TRUE
100 TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
??? It looks like it is taking the absolute value of both sides of the <!
What is going on?
Then I tried this, again using the ' to force it to be strings:
-30 -20 -10 0 10 20 30
-30 FALSE FALSE FALSE FALSE FALSE FALSE FALSE
-20 TRUE FALSE FALSE FALSE FALSE FALSE TRUE
-10 TRUE TRUE FALSE FALSE FALSE TRUE TRUE
0 TRUE TRUE TRUE FALSE TRUE TRUE TRUE
10 TRUE TRUE TRUE FALSE FALSE TRUE TRUE
20 TRUE TRUE FALSE FALSE FALSE FALSE TRUE
30 TRUE FALSE FALSE FALSE FALSE FALSE FALSE
again, it looks like it's taking absolute values!
But it's not just about numbers; something similar happens with text too.