I'm having an issue with the Logical Statements when using nested =IF() statements. Essentially, it's not following the Logical Statements correctly.
Here is an example of a formula that is failing:
=IF([Surplus]@row = [Deficit]@row, "No Variance", IF([Surplus]@row > [Deficit]@row, (([Surplus]@row - [Deficit]@row) +" over"), (([Deficit]@row - [Surplus]@row) +" under")))
Essentially, this formula looks at two cells that will only ever display a positive number or 0. If the numbers are equal to each other, it should display "No Variance". If they are not equal, it subtracts the smaller from the larger and then concatenates the string " over" or " under" depending on which was larger.
Failure Example 1:
Sometimes, when both [Surplus]@row and [Deficit]@row are 0, it skips the first Logical Statement and results in "0 over". In other rows where both are 0, it properly shows "No Variance".
So, sometimes it knows that 0 = 0. Sometimes it thinks that 0 > 0, or that 0 < 0.
Failure Example 2:
Sometimes, when [Surplus]@row > [Deficit]@row, it just skips right past that second Logical Statement and goes to the third. Example input/output:
[Surplus]@row = 10
[Deficit]@row = 5
Results: "-5 under"
It doesn't think 10 is greater than 5, which is confusing. Except sometimes it does. There is no rhyme or reason to when it does and doesn't work, its completely random.
I've tested all sorts of changes; it always does this for those cells. Certain cells/rows just can't use Logical Statements correctly. I have many different cells/columns where these formulas (or very similar ones) are used, and I'd say 75% of the time it picks the right logical statement, but the rest of the time it's wrong.
There are no error messages. The input numbers are not strings. The input numbers come from various different formulas. It does not appear to be an issue with the formula or the input. Testing the same formulas and input in different cells gives mixed results.
WHAT IS GOING ON? Am I going crazy? Have I missed something obvious? Please help!