Thread: -1^2+1 vs 1-1^2
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
impslayer impslayer is offline
external usenet poster
 
Posts: 22
Default -1^2+1 vs 1-1^2


Scriptick skrev:

Thanks, exactly what I could not find myself.
However, when I repeat the calculations in the immediate window in the
VBE both expressions -1^2+1 and 1-1^2 evaluate to 0. This is according
to the help function ("The order in which Microsoft Excel performs
operations in formulas", but then in the VBE help), but also confusing.


Had no idea that the operator precedence order was different in the
immediate window! Guess it comes from VB where (in VB6 anyway) ^ has
higher precedence than the unary - operator. In Excel formulas it's the
other way around.

/impslayer, who should probably go quiet for a couple of years
again