LN Function – Natural Logarithm – Excel, VBA & Google Sheets
Written by
Reviewed by
Download the example workbook
This tutorial demonstrates how to use the LN Function in Excel to calculate the natural logarithm to a number.
LN Function
The LN Function returns the natural logarithm of a number entered.
=LN(70)
LN & EXP Function
The inverse of LN Function is the EXP Function. If the EXP Function is nested within LN Function, it will return the original value.
=LN(EXP(6))
Alternatively, the same observation can be made if the argument is given as a power of e.
=LN(POWER(EXP(1),2))
Here the POWER Function raises the natural number e to the power of 2.
Note: The number natural e cannot be directly entered in Excel so EXP(1) is used.
LN & LOG Function
The LN Function is the special case of LOG Function with the base e. LOG(4,e) will return the same result as LN(4).
=LOG(4,EXP(1))
LN Function – Negative Number/Zero
The LN Function will return an error if the argument is zero or a negative number.
=LN(0)
=LN(-9)
LN in Google Sheets
The LN Function works exactly the same in Google Sheets as in Excel:
LN Examples in VBA
You can also use the LN function in VBA. Type:
application.worksheetfunction.ln(number)
For the function arguments (number, etc.), you can either enter them directly into the function, or define variables to use instead.
Application.WorksheetFunction.Ln(5)
will return the natural logarithm of number 5, which is 1.6094
Also, we can use an existing cell as an input parameter, so if we enter the following VBA command
Range("B1") = Application.WorksheetFunction.Ln(Range("A1"))
and the value in cell A1 is 4, we will get the following result: