VB / Excel : LOG / LN functions

If I do the same calculation between VB and Excel using the Log and LN functions, I seem to get the same result. However, I get different final answers between the cell in Excel and the variable in VB.
Formulae is as follows :
EXCEL FORMAT "=-0.08*LN(1-25/100)*1000000/365"
VB FORMAT "=-0.08*LOG(1-25/100)*1000000/365"

Try running this in VB and Excel and there is a different answer that results (Excel reports 65 whereas VB reports 63).
PS. Excel cell is formatted for no decimals, and the VB result is stored in an integer...

Which one is correct ?
staffiidbaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

deightonprogCommented:
65 is wrong, the correct answer is 63.05.. This should never have rounded to 65.  Check your formulae carefully in excel.  Perhaps some of the 'numbers' in your excel formulae may be derived from cells that contain numbers e.g 25 rounded to no dp's.  A possibility here is that the number in the cell could actually be 25.45 for example, but you would see 25, whereas Excel would use the full value unless you explicitly round of the decimals first using a rounding formula.
0
deightonprogCommented:
BTW

-0.08*LN(1-25/100)*1000000/365

gives me the same answer in Excel as -0.08*LOG(1-25/100)*1000000/365 in VB

I'm convinced the difference is somewhere else in your formula.  Possibly rounded values.
0
caraf_gCommented:
Yep, the correct result (rounded to an integer) is 63.

I looked at the formula, and nowhere can I find anything that, rounded, would explain the result of 65.

deighton must therefore be right. It could be explained if the value displayed as 25 is really approx. 25.66
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

deightonprogCommented:
VB is correct.  Exact value 63.0536049209383.  This value is also obtained from Excel when all figures in the formula are exact.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
staffiidbaAuthor Commented:
Adjusted points to 150
0
staffiidbaAuthor Commented:
Very well done.
Thanks for the prompt response.
The 0.08 is actually 0.08xxxxxxxx which explains the difference.
Thanks Deighton. Well done.
0
caraf_gCommented:
:-) Yes, even Micro$oft couldn't have f***ed up *this* bad. <g>
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.