Forum Discussion
Excel wrong calculation
It is documented in Calculation operators and precedence in Excel
Under Operator precedence, you'll see that - (negation) is evaluated before ^ (exponentiation). This is different from common practice in mathematics.
Thanks for pointing out MS's approach to expression evaluation. It is a pity that MS choose to not follow mathematical tradition. I have advanced degrees in math and physics and I would not have expected this behavior. I have even written expression parsers. Do common programming languages do the same, or has Excel marched down its own unique path? For example, I use Matlab from Mathworks and it reports -5^2 + 25 as 0, not as 50. Python reports -5**2 + 25 as 0 too.
- SergeiBaklanOct 22, 2024Diamond Contributor
That's common, at least in data modelling. You may check in Google Sheets and other spreadsheet software (not sure about all of them), -5**2 + 25 returns 50.
Another story is what for negation and subtraction here is used the same "-" symbol. In some languages they are different.