Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problems with WorksheetFunction.Index and WorksheetFunction.Match | Excel Programming | |||
Using code to replace code modules | Excel Programming | |||
Replace text with variable using VBA replace code? | Excel Programming | |||
WorkSheetFunction.CountIf & WorkSheetFunction.SumIf with 2 conditions? | Excel Programming |