LN Excel Function

Publication Date :

Blog Author :

Download FREE LN Function Excel Template and Follow Along!
LN Function Excel Template.xlsx

Table Of Contents

arrow

LN Function in Excel

We have a logarithm function or LOG function in arithmetic, the opposite of exponentiation. In Excel, we have a similar function to calculate the logarithm of a given number. This function is the LN function in Excel which takes a single number as the argument and shows the result as the logarithm.

It is a built-in function in MS Excel. The LN Excel function 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 if the base e is implicit, log x.

So, Ln(Number) = LOG (Number, e)

Where e~= 2.7128

Below is the LN Function Graph

LN Figure

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 for the LN function in Excel is as follows:

LN Formula

The LN formula has three arguments, out of which two are optional. When,

  • 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. The Excel LN function can be inserted as a part of the formula in a worksheet cell as a WS function. Refer to the examples given below to understand better.

Example #1 – Fractional number

LN Example 1

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.

Example #2 – Zero number

Example 2

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. Unfortunately, the number is 0, and we cannot calculate the log of 0. The LN function in Excel does not accept the number value as zero, so the error is thrown in return. The error is #NUM! Which indicates the number is erroneous.

Example #3 – Integer number

Example 3

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

Example 4

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. Unfortunately, the number is ‘abc,’ and we cannot calculate the log of non-numeric value. So, the LN function in Excel returns an error when we cannot calculate the log for such a value. The error is #VALUE! which indicates the value is erroneous.

Example #5 – Negative Number

Example 5

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 we cannot calculate the log of a negative number. 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 shows the number is incorrect.

Things to Remember

  • The LN function in Excel accepts only a positive real number as its parameter. Therefore, 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.
  • 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.

LN VBA Excel

Example:

Let us look at the example given below for a better understanding.

logVal = LOG (5)

logVal: 1.609437912

Here, 5 is the number for which the natural logarithm function is calculated. Log (5) to the base e is 1.609437912. So, the variable logVal holds a value of 1.609437912.