I was wondering if excel has a bult-in function that calculates the percent error between two numbers. I wrote my own function to do it, but I was curious to know if there is an existing one. Heres the code to the function.
Thanks.Code:Public Function percentdiff(Expected As Single, Actual As Single) As Single Dim diff As Single diff = Abs((Expected - Actual) / Expected) * 100 percentdiff = diff End Function
I don't know of one. Thank you for putting this one up. I may never need it, but a simple calculation like this is ideal to show just how to code a user-defined function, and if I ever need to write one, I'll come and look at yours! Cheers.
There are currently 1 users browsing this thread. (0 members and 1 guests)