Excel Tutorial

Excel LOG Function



The Excel LOG function returns the natural logarithm (base e) of a given number.

The LOG function is a built-in function in Excel that is categorized as a Math/Trig Function. It can be used as a VBA function in Excel. As a VBA function, this function can be used in a Excel macro code. The Excel macro code can be created using the Microsoft Visual Basic Editor.

The Excel LOG function can also be used as a worksheet function in Excel with a different syntax. For more information, see LOG as worksheet function.

Syntax

LOG(number)

Parameters

number Required. Specify a numerical value greater than 0 to get the logarithm of.

Return Value

Returns the natural logarithm of a value.

Notes

  • If the arguments is less than or equal to 0, LOG function will raise an error.

Example: Using as VBA Function

The LOG function can be used in VBA code in Microsoft Excel. Consider the example below:

Dim FValue As Double

FValue = LOG(2)

In this example, the variable called FValue will contain the value of 0.693147180559945.

Similarly, for the different input the VBA code will give the following output:

LOG(1)
Result: 0

LOG(2.5)
Result: 0.916290731874155

LOG(3)
Result: 1.09861228866811

LOG(10)
Result: 2.30258509299405

LOG(50)
Result: 3.91202300542815

❮ Excel Functions