View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Excel and VBA calculate the same formula differently

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


Not sure why you get diffs! I get 0.596457635847984 for both your formulas!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion