I have this Google Sheets table with input1 and input2 and curiously, comparing the text, the output returned TRUE
and FALSE
! How is the output determined?
Does Google Sheets like dogs more than cats?
Input1 | Input2 | Output | FORMULATEXT |
---|---|---|---|
Cat | Dog | FALSE | =A2>B2 |
Dog | Cat | TRUE | =A3>B3 |
Dog | Dog | FALSE | =A4>B4 |
Dog | Dog | FALSE | =A5>B5 |
Cat | Cat | FALSE | =A6>B6 |
Cat | Dog | FALSE | =A7>B7 |
Dog | Cat | TRUE | =A8>B8 |
Dog | Cat | TRUE | =A9>B9 |
Dog | Cat | TRUE | =A10>B10 |
Cat | Dog | FALSE | =A11>B11 |
CodePudding user response:
Each character is checked against another, one by one.
In case of Dog
vs Cat
, the first character is checked and if it is greater based on lexicographic-ordering(Which maybe based on CODE
), returns TRUE
and no more checking is performed. If however, they're both the same character, next character is taken and compared: Dog
>Dng
. Here, D
is the same, so o
is compared against n
and if they're equal, goes to the next character and so on.
All the code of characters isn't summed. For eg,
="D">"CZZZZZ"
will always return true
regardless of the number of Z
after the first C
, because D
is greater than C