Forum Discussion
SergioSolimena
Apr 04, 2019Copper Contributor
A case of wrong formula calculation in Excel?
I like to have your opinion on the formula calculation performed by Excel in a particolar case that surprised me very much. This is the case. A(1,1) =5 A(2,1) = - A1^2 Excel display result in A(2...
SergioSolimena
Apr 04, 2019Copper Contributor
What you says is clear but it's not correct because in the formula y=-x^2 the result is always negative for any x different from zero.
I don't have to use the parenthesis.
As I shown in the example, the same formula y= -A^2 +A =+A- A^2 is written in two different way, only changing the position af the two addendum. The result must be exactly the same. But this not what Excel does.
This means that it necessary to put attention at the order of the addendum in a sum, and this violates the commuted property of the terms of the sum.
Because now I know this question I put always attention when i write a formula, but in a complex problem this not simple and reliable.
I don't have to use the parenthesis.
As I shown in the example, the same formula y= -A^2 +A =+A- A^2 is written in two different way, only changing the position af the two addendum. The result must be exactly the same. But this not what Excel does.
This means that it necessary to put attention at the order of the addendum in a sum, and this violates the commuted property of the terms of the sum.
Because now I know this question I put always attention when i write a formula, but in a complex problem this not simple and reliable.
Detlef_Lewin
Apr 05, 2019Silver Contributor
*
SergioSolimena wrote:
As I shown in the example, the same formula y= -A^2 +A =+A- A^2 is written in two different way, only changing the position af the two addendum. The result must be exactly the same. But this not what Excel does.
*
As you can see in the table provided by PeterBartholomew1 the - (minus sign) in the first case is a negation (a lower order then ^) and in the second case a subtraction (a higher order then ^).
So by putting parenthesis around A^2 you are changing the order of operation:
-(A^2)+A = +A-(A^2)
- SergioSolimenaApr 05, 2019Copper ContributorDetlef_Lewin wrote:
As you can see in the table provided by PeterBartholomew1 the - (minus sign) in the first case is a negation (a lower order then ^) and in the second case a subtraction (a higher order then ^.
-
Thanks for the reply.
The Excel rules are clear but unfortunately they are different, in this particular case, from the mathematical rules. This can generate an unexpected result and you have to be careful.
Thanks again.