Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Replace Worksheetfunction.ln code

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Replace Worksheetfunction.ln code


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/sh...d.php?t=186592

Excel Live Chat

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default Replace Worksheetfunction.ln code

Help seems to suggest that they are the same thing.

--

HTH

Bob

"michelle439731" wrote in message
...
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Replace Worksheetfunction.ln code

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" wrote in message
...
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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Replace Worksheetfunction.ln code

Superb, that is exactly what I wanted to know.

And a history lesson too.

Thank you very much,

Michelle
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with WorksheetFunction.Index and WorksheetFunction.Match Luke Excel Programming 4 October 14th 09 12:57 AM
Using code to replace code modules PO Excel Programming 1 April 4th 08 12:26 PM
Replace text with variable using VBA replace code? Mike[_112_] Excel Programming 2 November 9th 06 06:06 PM
WorkSheetFunction.CountIf & WorkSheetFunction.SumIf with 2 conditions? Etien[_2_] Excel Programming 3 January 13th 04 04:07 PM


All times are GMT +1. The time now is 10:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"