TheSwamp

Code Red => VB(A) => Topic started by: sbattina on February 18, 2004, 03:26:53 PM

Title: VBA math help
Post by: sbattina on February 18, 2004, 03:26:53 PM
Hi guys:
Its crazy.. but I need a function in VBA that does:
 inverse log (x) .
Is it possible? What are my options?
Can someone help me with this??
 :shock:

Battina
Title: VBA math help
Post by: TR on February 18, 2004, 06:31:23 PM
Try This:

Code: [Select]

Private Function Test(Number As Double) As Double
    Test = Log(Exp(Number))
End Function


I don't have VBA installed so I'm not 100% sure that'll work. However in VBA you can use the Log() and Exp() functions for what you're trying to do.
Title: VBA math help
Post by: Keith™ on February 18, 2004, 10:32:08 PM
Tim is right ....
Code: [Select]

y = log(x)
'inverse
x = exp(y)
Title: thanks!
Post by: sbattina on February 19, 2004, 03:52:37 AM
Thanks guys,
I am going to try it
Battina
Title: Re: VBA math help
Post by: MalFarrelle on June 14, 2012, 09:43:31 AM
I know this is a very old thread but I happened on it wanting to find the answer (VBA inverse log of x) and Google seems quite confident this thread answers the question.  Others probably will find themselves here so I am taking the liberty of providing the proper conclusion for those yet to come this way . . .

The earlier answer neglects the important fact that the VBA logarithmic functions yield Natural (Naperian) logs.  To calculate Common Logs and Inverse Common Logs use the following:

    CommonLogx = Log(x) / Log(10)
    InverseCommonLogX = Exp(x * Log(10))

Title: Re: VBA math help
Post by: Mark on June 14, 2012, 10:34:14 AM
I know this is a very old thread but I happened on it wanting to find the answer (VBA inverse log of x) and Google seems quite confident this thread answers the question.  Others probably will find themselves here so I am taking the liberty of providing the proper conclusion for those yet to come this way . . .
Thank you very much! :)