View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Auric__ Auric__ is offline
external usenet poster
 
Posts: 538
Default Excel and VBA calculate the same formula differently

Ottmar Brandau wrote:

I have a strange phenomenon. In Excel the following expression:
LN(8/PI()^2*280/125) equates to 0.596458. In VBA the code:
Log(8/(4*Atn(1))^2*280/125 comes out to 0.554588, a difference of over
7%. I makes no difference to replace (4*Atn(1)) with 3.14, the
difference is basically the same and it screws up my calculation. BTW,
Log in VBA is the same as LN in Excel. Does somebody have an idea why
this is and how to correct it? Thanks. Ottmar


I get the same results as Garry. VBA is returning the wrong value for you. As
for *why*, we'd need to see your code.

--
The key to being a genius is timing.