In arithmetic, we have a logarithm function or LOG function which is just opposite of exponentiation, in excel we have a similar function to calculate the logarithm of a given number and this function is LN function in excel which takes a single number as the argument and gives the result as the logarithm.
LN Function in Excel
It is a built-in function in MS Excel. LN excel is categorized under Math Functions in MS Excel. Excel LN is used to calculate the natural logarithm of a number.
What is the Natural Logarithm Function?
The natural logarithm of a number is its logarithm to the base of the mathematical constant e, where e is an irrational and transcendental number approximately equal to 2.718281828459. The natural logarithm function of x is generally written as ln x, loge x, or sometimes, if the base e is implicit, simply log x.
So, Ln(Number) = LOG (Number, e)
Where e~= 2.7128
Below is the LN Function Graph
In the LN Function Graph above, the X-axis indicates the number for which log is to be calculated, and the Y-axis indicates the log values. E.g., log(1) is 0, as shown in the LN Function Graph.
LN Formula in Excel
The formula of LN function Excel is as follows:
LN Formula has three arguments, out of which two are optional. Where,
- number = This is a required parameter. It indicates the number for which the natural logarithm function is to be calculated. The number must be a positive real number.
- If the parameter is a negative number, it returns an error with #NUM! indicating an error with the number.
- If the parameter is zero, it returns an error with #NUM! indicating an error with the number.
- If the parameter is a non-numeric value, it returns an error with #VALUE! indicating an error with the generated value.
How to use LN Function in Excel?
The said function is a Worksheet (WS) function. As a WS function, Excel LN Function can be entered as a part of the formula in a cell of a worksheet. Refer to the examples given below to understand better.
Example #1 – Fractional number
In this example, cell C2 has an LN formula associated with it. So, C2 is a result cell. The first argument of the LN is B2, the number for which log is to be calculated. The number is 0.5, and the log of 0.5 is -0.693147. So, the value of the resultant cell is -0.693147.
4.9 (1,353 ratings) 35+ Courses | 120+ Hours | Full Lifetime Access | Certificate of Completion
Example #2 – Zero number
In this example, cell C4 has an LN formula associated with it. So, C4 is a result cell. The first argument of the LN is B4, the number for which log is to be calculated. The number is 0, and the log of 0 cannot be calculated. LN function in Excel doesn’t accept number value as zero, and hence the error is thrown in return. The error is #NUM! which indicates the number is erroneous.
Example #3 – Integer number
In this example, cell C6 has an LN formula associated with it. So, C6 is a result cell. The first argument of the LN is B6, the number for which log is to be calculated. The number is 5, and the log of 5 is 1.609437912. So, the value in the resultant cell is 1.609437912.
Example #4 – Non-numeric Value
In this example, cell C8 has an LN formula associated with it. So, C8 is a result cell. The first argument of the LN in excel is B8, the number for which log is to be calculated. The number is ‘abc,’ and the log of non-numeric value cannot be calculated. LN function in Excel returns an error when the log cannot be calculated for such a value. The error is #VALUE! which indicates the value is erroneous.
Example #5 – Negative Number
In this example, cell C10 has an LN formula associated with it. So, C10 is a result cell. The first argument of the LN in Excel is B10, the number for which log is to be calculated. The number is -1.2, and the log of a negative number cannot be calculated. Since the value is negative, the LN function in Excel returns an error indicating the value is erroneous. So, the value in the resultant cell is #NUM! which indicates the number is erroneous.
Things to Remember
- The LN function in Excel accepts only a positive real number as its parameter. The divisor cannot be zero.
- If the parameter is a negative number, it returns an error with #NUM! indicating an error with the number.
- If the parameter is zero, it returns an error with #NUM! indicating an error with the number.
- If the parameter is a non-numeric value, it returns an error with #VALUE! indicating an error with the generated value.
Excel VBA for a Similar Purpose
VBA has a separate inbuilt function to calculate the natural logarithm function, which is LOG. It can be used as follows.
Example:
Let’s look at the example given below for better understanding.
logVal = LOG (5)
logVal: 1.609437912
Here, 5 is the number for which the natural logarithm function is to be calculated. Log (5) to the base e is 1.609437912. So, the variable logVal holds value 1.609437912.
Recommended Articles
This has been a guide to LN Function in Excel. Here we discuss the LN Formula in excel and how to use the LN function along with excel example and downloadable excel templates. You may also look at these useful functions in excel –
- 35+ Courses
- 120+ Hours
- Full Lifetime Access
- Certificate of Completion