Applies ToAccess for Microsoft 365 Access 2024 Access 2021 Access 2019 Access 2016

Returns a Double specifying the natural logarithm of a number.

Syntax

Log( number )

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

Remarks

The natural logarithm is the logarithm to the base e. The constante 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:

Note: Examples that follow demonstrate the use of this function in a Visual Basic for Applications (VBA) module. For more information about working with VBA, select Developer Reference in the drop-down list next to Search and enter one or more terms in the search box.

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

Query example

Expression

Results

SELECT Log(90) AS Logarithm FROM ProductSales GROUP BY Log(90);

Returns the "Log" of the number argument and displays in the column Logarithm.

VBA example

This example uses the Log function to return the natural logarithm of a number.

Dim MyAngle, MyLog' Define angle in radians.MyAngle = 1.3' Calculate inverse hyperbolic sine.MyLog = Log(MyAngle + Sqr(MyAngle * MyAngle + 1))

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.