Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default USING LOG and LN

Hello:

When I use this line in piece of code

targetRange(x) = Log(sourceRange(i) * 10)

The target range contains the natural log or ln value

When I use this line in a piece of code

Range("C1:C3").Formula = "=LOG(A1*10)"

The range log to base 10 or log value.

Why is that?

How do I get log to base 10 using the first line ?

Thanks

Ravi


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default USING LOG and LN

Different definitions: VBA and Excel functions are not always equivalent

From VB help file:
Log(number)

The required number argument is a Double or any valid numeric expression
greater than zero.

Remarks

The natural logarithm is the logarithm to the base e. The constant e is
approximately 2.718282.

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 illustrates a custom Function that calculates base-10
logarithms:

Static Function Log10(X)
Log10 = Log(X) / Log(10#)
End Function

From Excel help:

LOG
See Also

Returns the logarithm of a number to the base you specify.

Syntax

LOG(number,base)

Number is the positive real number for which you want the logarithm.

Base is the base of the logarithm. If base is omitted, it is assumed to be
10.



--
- K Dales


"ravi" wrote:

Hello:

When I use this line in piece of code

targetRange(x) = Log(sourceRange(i) * 10)

The target range contains the natural log or ln value

When I use this line in a piece of code

Range("C1:C3").Formula = "=LOG(A1*10)"

The range log to base 10 or log value.

Why is that?

How do I get log to base 10 using the first line ?

Thanks

Ravi


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



All times are GMT +1. The time now is 03:25 AM.

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

About Us

"It's about Microsoft Excel"