How to Use Excel LOG Function (5 Easy Methods)

The LOG function is categorized as a Math & Trigonometry function in Excel. Besides that, it is also a worksheet function; which means it can be used in combination with other functions in Excel. Moreover, this function is very simple and easy to use. This function is widely used in business analytics, statistics, and finance, etc. So, in this article, I am going to discuss the details of the LOG function and its application too.


Download the Practice Workbook

You can download the practice workbook that we have used to prepare this article.


Introduction to Excel LOG Function

  • Summary

Returns the logarithm of a number to the base you specify. According to mathematics, the logarithm is the inverse to exponentiation. That means the logarithm of any given number is the exponent to which the base has to be raised to get a specified number. For instance, if x is the exponent of base b to get the value y.

bx=y Then logby=x

  • Syntax

LOG(number, [base])

Introduction to Excel LOG Function

  • Arguments
Arguments Requirement Explanations
number Required The positive real number for which we want the logarithm (e.g. 64, 8, 2.1, etc.). This value is numeric and must be greater than zero.
base Optional This base is used to calculate the logarithm of a number. If this parameter is omitted, the function will use a base of 10.
  • Return Value

The LOG function returns a numeric value.

  • Available in Version

Excel for Office 365, Excel 2019, Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000.


5 Examples to Use Excel LOG Function

1. Apply Excel LOG Function Without Base Argument 

When the second argument of the LOG function: [base] is not supplied, the function assumes the base value as 10 automatically. For example, we will find the logarithm of 10000. So, follow the below steps to get the result:

Steps:

  • First, type the following formula in Cell D5.
=LOG(B5)

Apply Excel LOG Function Without Base Argument 

  • As a consequence, you will get the logarithm value for 10000; which is 4.

Apply Excel LOG Function Without Base Argument 

Here, Excel calculates the logarithm value and returns as 4. It means the number 10 is multiplied 4 times to get 10000 (10*10*10*10).

  • Next, use the Fill Handle (+) tool to copy the formula to the rest of the cells to get the logarithm value.

  • Finally, here is the result for the rest of the cells.

Read More: How to Use Excel EXP Function (5 Examples)


2. Use LOG Function With Base Argument in Excel

Unlike Method 1, in this example, we will apply both arguments of the LOG function. Such as, we will find the logarithm value for 125 with the base value of 5.

Steps:

  • Initially, type the below formula in Cell D5.
=LOG(B5,C5)

Use LOG Function With Base Argument in Excel

  • As a result, you will find that the logarithm value is 3.

Use LOG Function With Base Argument in Excel

Here, the result means base 5 raised to power 3 to get 125.

  • Lastly, for the rest of the cells use the Fill Handle (+) to copy the formula.


3. Put Decimal Value as Base Argument

You can use variations in using the options [base] value. For instance, you can use decimal values as base values. In this method, we will find out the logarithm of 10, for the base value of .25. So, follow the steps associated with the method.

Steps:

  • In the beginning, type the following formula in Cell D5.
=LOG(B5,C5)

Put Decimal Value as Base Argument in LOG Function

  • Consequently, you will find the below result.

Put Decimal Value as Base Argument in LOG Function

Here, the function calculates the logarithm for 10 with base value: .25 and returns -1.660964047. It means .25-1.660964047=10, and Log.25(10) = -1.660964047.

  • At last, use the Fill Handle (+) to copy the formula to the rest of the cells.


Similar Readings


4. Use VBA to LOG Function

Now we will use the VBA to get the logarithm for a particular number with a base value. For instance, we will find out the logarithm of 216 with the base value of 6. So, here are the steps associated with the process:

Steps:

  • First, go to the worksheet containing the data and right-click on the sheet name. Next, click on the View Code.

Use VBA to LOG Function

  • Now, the Code Module window will show up. Then, write the below code on the module.
Option Explicit
Function LogAny(b As Double, y As Double) As Double
    ' b: base y: a given number
    LogAny = Log(y) / Log(b)
End Function
Sub Log_VBA()

    MsgBox LogAny(6, 216)

End Sub
  • After that, Run the code.

Use VBA to LOG Function

  • In conclusion, you will see that the formula returns 3 in the message box.


5. Application of LOG and POWER Functions in Excel

The POWER function is the inverse of the LOG function. For instance, we have a base value of 5 and exponent 3. So, we will follow the below steps to get the logarithm associated with the previously mentioned base and exponent value using both the POWER and LOG functions.

Steps:

  • First, type the below formula to Cell C7.
=LOG(POWER(C5,C6),C5)

Application of LOG and POWER Functions in Excel

Here, the POWER function returns the result of a number raised to a power. The POWER formula will return 125. Later, we passed the POWER function to the LOG function to get the logarithm of 125 with the base 5.

  • In the end, you will get the exponent 3, using the combination of functions.


LOG Function Errors

Although the LOG function is very easy to use, it returns errors at times. Such as, if you do not enter the base value properly, the function will return the following errors.

  • #NUM!: It happens when the [base] is negative or zero, then the function returns this error.

LOG Function Errors

  • #VALUE!: If the [base] argument is non-numeric.

LOG Function Errors

  • #DIV/0!: This occurs when the [base] argument is supplied as 1.


Conclusion

In the above article, I have tried to discuss the methods elaborately. Hopefully, these methods and explanations will be enough to solve your problems. Please let me know if you have any queries.


Related Articles

Hosne Ara

Hosne Ara

Hi, This is Hosne Ara. Currently, I do write for ExcelDemy. I have a long experience working with different industries and I have seen how vast the scope of Microsoft Excel is. So, eventually, I started to write articles on Excel and VBA. Basically, my articles are targeted to help people who are working in Excel. By profession, I am an Engineer. Materials and Metallurgical Engineering is my major. Besides, I am a certified Project Manager (PMP) too. I have worked with Power Plant and IT industry earlier. As a person, I am detail-oriented and love doing research. Establishing a greener world is one of my mottos.

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo