PDA

View Full Version : Results of my equation and function don't match



danafer
03-17-2010, 07:35 AM
Greetings! I'm a newer VBA programmer, and don't understand why the results of my VBA function don't match the result the same equation in a cell. Any thoughts?

My equation: =(E8/((1/CD8)*(CI8-(D8^2)*CF8)^0.5))

My function, where:
B = CD8
P = D8
D = E8
BSE2 = CI8
ASE2 = CF8

Function Zscore (B, P, D, BSE2, ASE2)
Zscore = D / ((1 / B) * (BSE2 - (P ^ 2) * ASE2) ^ 0.5)
End Function

Jan Karel Pieterse
03-17-2010, 08:11 AM
Seems to work OK for me. What difference do you get, maybe it is just a tiny rounding issue?

mbarron
03-17-2010, 08:16 AM
The values matched once I got all of the cell references straight.

Bob Phillips
03-17-2010, 08:18 AM
My test gave exactly the same results. What values give differing answers.

danafer
03-17-2010, 08:44 AM
My appologies, I had my ASE2 and BSE2 mixed up... please disregard. Thanks to those of you who replied so quickly!

mdmackillop
03-17-2010, 12:28 PM
Hi Danafer,
Welcome to VBAX. You can mark your thread solved using the Thread Tools dropdown.
Regards
MD