Method 1 – Use Excel LOG Function
The LOG function computes the logarithm of a number to a particular base. In order to use the LOG function, select a cell and enter the function as shown below.
Steps:
- To find log base 2, select an output cell (In this example, D5).
- Enter the following formula and press ENTER.
=LOG(B5,C5)
Here is the result.
Similar Readings
- How to Calculate Natural Logarithm in Excel
- How to Do Inverse Log in Excel
- How to Log Transform Data in Excel
Method 2 – Apply VBA to Calculate Log Base 2
Steps:
- Go to Developer tab >> Visual Basic >> Insert >> Module. A module window will open.
- Enter the following code in the module window.
Function LogRND(N As Double, X As Double) As Double
LogRND = Log(X) / Log(N)
End Function
Sub Log_N_Based()
MsgBox LogRND(2, 1000)
End Sub
A pop-up shows the result.
Read More: How to Calculate Logarithmic Growth in Excel
Download Practice Workbook
Related Articles
- How to Calculate Log in Excel
- How to Take Log of Negative Numbers in Excel
- How to Calculate Antilog in Excel
- How to Plot Log Scale in Excel
- How to Plot Log Log Graph in Excel
- Excel Logarithmic Scale Start at 0
<< Go Back to Excel LOG Function | Excel Functions | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!