How to Calculate Log Base 2 in Excel (2 Methods)

 

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.

Use LOG Function

Steps:

  • To find log base 2, select an output cell (In this example, D5).
  • Enter the following formula and press ENTER.
=LOG(B5,C5)

Use LOG Function to Calculate Log Base 2 in Excel

Here is the result.

Use LOG Function to Calculate Log Base 2 in Excel


Similar Readings


Method 2 – Apply VBA to Calculate Log Base 2

 

Steps:

  • Go to Developer tab >> Visual Basic >> Insert >> Module. A module window will open.

Apply VBA Log Function

  • 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

Apply VBA Log Function to Calculate Log Base 2 in Excel

A pop-up shows the result.

Apply VBA Log Function

Read More: How to Calculate Logarithmic Growth in Excel


Download Practice Workbook

 


Related Articles


<< Go Back to Excel LOG Function | Excel Functions | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Hafizul Islam
Hafizul Islam

Hafizul Islam is an excellent marine engineer who loves working with Excel and diving into VBA programming. For him, programming is like a superhero tool that saves time when dealing with data, files, and the internet. His skills go beyond the basics, including Rhino3D, Maxsurf C++, AutoCAD, Deep Neural Networks, and Machine Learning. He got his B.Sc in Naval Architecture & Marine Engineering from BUET, and now he's switched gears, working as a content developer. In this role,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo