Access 2003 functions

C

crhiggins

I am trying to calculate a geometric mean in a report. Access does not have a
geometric mean function. I can do it using common logarithims and
anitlogarithims, but I can only find a natural logarithim function and an exp
function that also is based on natural logs. Without going into excel, does
anybody have any suggestions?

Thanks

Chris
 
K

Krzysztof Pozorek [MVP]

U¿ytkownik "crhiggins said:
I am trying to calculate a geometric mean in a report. Access does not have
a
geometric mean function. I can do it using common logarithims and
anitlogarithims, but I can only find a natural logarithim function and an
exp
function that also is based on natural logs. Without going into excel,
does
anybody have any suggestions?

You can write own function for common logarithim (basing on natural
logarithm):

Public Function Log10(Num)
Log10 = Log(Num) / Log(10)
End Function

K.P.
 
D

Douglas J. Steele

Yes, the Log function returns the natural log. However, you can calculate
base-n logarithms for any number x by dividing the natural logarithm of x by
the natural logarithm of n as follows:

Logn(x) = Log(x) / Log(n)

The following example from the Help file illustrates a custom Function that
calculates base-10 logarithms:

Function Log10(X As Double) As Double
Log10 = Log(X) / Log(10#)
End Function

To get the inverse of Log10, you'd simply use the ^ operator to raise 10 to
the power of the exponent:

Function Exp10(X As Double) As Double
Exp10 = 10# ^X
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top