From: michelle439731 on
Morning,

I want to replace the code "worksheetfunction.ln" with "math.log" in my code.
Is this the same calculation? If not what piece of code should I be using.

Thank you very much for your help,

Michelle
From: joel on

The math constand "e" is approximately 2.3. To get the exact value you
use the ln(1).

Ln and log are equivalent functions that give different results because
the base is different. Ln the base is the constand "e", while log base
is usually 10 but can be others bases.


There are 3 functions in excel
LN(Number), LOG(Number,Base), LOG10(Number)

LOG10(Number) = LOG(Number,10)
LN(Number) = LOG(Number,LN(1))


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=186592

[url="http://www.thecodecage.com/forumz/"]Excel Live Chat[/url]

From: Bob Phillips on
Help seems to suggest that they are the same thing.

--

HTH

Bob

"michelle439731" <michelle439731(a)discussions.microsoft.com> wrote in message
news:9A37CC60-FBFE-45F3-8213-9E60040B7A47(a)microsoft.com...
> Morning,
>
> I want to replace the code "worksheetfunction.ln" with "math.log" in my
> code.
> Is this the same calculation? If not what piece of code should I be
> using.
>
> Thank you very much for your help,
>
> Michelle


From: Rick Rothstein on
Yes, VB's built-in Log function is the same as the worksheet's LN
function... they are both what is known as the "Natural Log" function
(logarithm to the base e). I think the reason for the different names is
that VB's Log function is the only one provided (VB is based on the BASIC's
of old where I'm guessing the name for the function was chosen because it is
spelled the way it sounds) whereas the worksheet provides two logarithm
functions, LN and LOG... where LOG defaults to base 10 (LOG is the normal
way mathematicians/statisticians spell the "logarithm to the base 10") and,
as discussed, LN is the "logarithm to base e" which is spelled LN in
mathematical circles. So, VB used a name created decades ago for its only
logarithm function in order to (I'm guessing) make it easy to remember
within a language developed to make programming easier to learn overall,
while it appears Excel chose to use the more normally accepted spellings for
its two "logarithm functions.

I did want to point out that you do not need to proceed VB's Log function
with its library name (Math)... that is the default, so you can just use
Log(YourNumber) in your code.

--
Rick (MVP - Excel)


"michelle439731" <michelle439731(a)discussions.microsoft.com> wrote in message
news:9A37CC60-FBFE-45F3-8213-9E60040B7A47(a)microsoft.com...
> Morning,
>
> I want to replace the code "worksheetfunction.ln" with "math.log" in my
> code.
> Is this the same calculation? If not what piece of code should I be
> using.
>
> Thank you very much for your help,
>
> Michelle

From: michelle439731 on
Superb, that is exactly what I wanted to know.

And a history lesson too.

Thank you very much,

Michelle