This Excel tutorial explains how to use the Excel LOG function with syntax and examples.
The Microsoft Excel LOG function returns the logarithm of a number to a specified base.
The syntax for the Microsoft Excel LOG function is:
LOG( number, [base] )
The LOG function can be used in the following versions of Microsoft Excel:
The LOG function can be used in Microsoft Excel as the following type of function:
Let's look at some Excel LOG function examples and explore how to use the LOG function as a worksheet function in Microsoft Excel:
Based on the Excel spreadsheet above, the following LOG examples would return:
=LOG(A1) Result: 1.301029996 =LOG(A1, 10) Result: 1.301029996 =LOG(A1, A2) Result: 0.930676558 =LOG(A2, 5.1) Result: 1.975690972 =LOG(200, 3) Result: 4.822736302
The LOG function can also be used in VBA code in Microsoft Excel. However in VBA, the LOG function returns the natural logarithm of a number and its syntax is different than the worksheet function.
The syntax for the Microsoft Excel LOG function in VBA code is:
Log( number )
number is a numeric value that must be greater than 0.
Let's look at some Excel LOG function examples and explore how to use the LOG function in Excel VBA code:
Dim LResult As Double LResult = Log(20)
In this example, the variable called LResult would now contain the value 2.995732274.
(scroll to see more)