# How to Transform Data to Log in Excel (3 Easy Ways)

While working with data in excel, sometimes we use natural logs of the values in our analysis instead of using the source data. The transformation of data to log is useful for data in which the revenues increase as the dependency variable’s value increases. This also reduces data variance and helps information correspond to the normally distributed relatively accurately. In this article, we will demonstrate a variety of ways to transform data to log in excel.

## Why Do We Need to Transform Data to Log?

The technique of changing information from one place or pattern elsewhere is known as Transform Data. The purpose of transforming data is to provide the data in the most efficient way possible. In Excel, it refers to a certain procedure carried out using Excel functions and tools.

When our data set does not resemble the regular pattern, we may log convert it to get it as normal as feasible, increasing the validity of the quantitative results obtained. The transform data to log, in other respects, decreases or eliminates the distortion of our source data. It’s nearly hard to list all of the applications for Excel data transformation, so here are some:

• Appropriate statistical processing.
• Using a vast quantity of data to do mathematical computations.
• Organizing financial information.
• Among these are business analytics and a slew of others.
• Based on their aims and demands, each specialty might transform data in a unique manner.

Assume we are going to use Excel to change numeric values. We may use a variety of Excel functions. In terms of transforming data, Excel includes a plethora of procedures that may be used to do so. In most circumstances, these capabilities will suffice to help to organize and analyze our data.

To transform data to log, we are using the following dataset. The dataset contains some employee names and their annual sales. Now, we need to transform the annual sales data to log. So, let’s get started.

### 1. Use Excel LOG Function to Transform Data to Log

To transform data to log, the first main method we are using is the LOG function. The LOG function in Microsoft Excel calculates the logarithm of an integer in a given base. This is an Excel built-in function that is classified as a Math/Trig function. There are two arguments; number and base. But the base of the logarithm is optional, we can use it or not.

#### 1.1. With Base

We will utilize the LOG function in the manner with base 2. We can not use negative 1 or 0 as a basis. Without further ado, let’s get started with the step-by-step instructions.

📌 STEPS:

• Firstly, select the cell where you want to put the formula of the LOG function. So, we select cell E5.
• Secondly, put the formula into that selected cell.
`=LOG(C5,2)`
• Thirdly, press Enter.

• Now, drag the Fill Handle down to duplicate the formula over the range. Or, to AutoFill the range, double-click on the plus (+) symbol.

• Finally, you can see the result. And the result is to display the annual sales data in log data with base 2.

#### 1.2. Without Base

In this part, we will utilize the Excel LOG function to modify data without a basis. Excel will presume the base is 10 if we do not provide any information about it. Let’s see the steps for this.

📌 STEPS:

• To begin with, choose the cell (E5) where you want to insert the LOG functions’ formula.
• Secondly, type the formula below into the selected cell.
`=LOG(C5)`
• Further, press the Enter key to finish the procedure.

• Furthermore, to copy the formula over the range, drag the Fill Handle down or double-click on the plus (+) icon.

• Lastly, you will be able to see the transformed annual sales data to log with excel’s presumed default base 10.

Read More: How to Log Transform Data in Excel (4 Easy Methods)

### 2. Insert LOG10 Function to Convert Data to Log in Excel

Now, we will use the LOG10 function to transform data to log in to excel. This function returns a number’s logarithm value, with the base always being 10. We will show how to modify this base using a different function in a different manner. We have also introduced a column called ‘Logarithm Value’ to which the altered data will be returned. Let’s follow the procedures to use the function for transforming data into logs.

📌 STEPS:

• Similarly, as in the previous method, select cell E5 and substitute the formula.
`=LOG10(C5)`
• Then, press Enter. And the formula will show in the formula bar.

• Further, to replicate the formula throughout the range, drag the Fill Handle downward. To AutoFill the range, double-click on the plus (+) symbol.

• Finally, you can see the data is transformed into a log with base 10.

### 3. Apply Excel VBA to Change Data to Log

With Excel VBA, users can easily use the code which acts as excel functions. To use the VBA code to transform data to log, let’s follow the procedure.

📌 STEPS:

• Firstly, go to the Developer tab from the ribbon.
• Secondly, from the Code category, click on Visual Basic to open the Visual Basic Editor. Or press Alt + F11 to open the Visual Basic Editor.

• Instead of doing this, you can just right-click on your worksheet and go to View Code. This will also take you to Visual Basic Editor.

• This will appear in the Visual Basic Editor where we write our codes to create a table from range.
• Thirdly, click on Module from the Insert drop-down menu bar.

• This will create a Module in your workbook.
• And, copy and paste the VBA code shown below.

VBA Code:

``````Sub TransformDataToLog()
Dim inte As Integer
For inte = 5 To 10
Cells(inte, 4) = Log(Cells(inte, 3))
Next inte
End Sub``````
• After that, run the code by clicking on the RubSub button or pressing the keyboard shortcut F5.

You don’t need to change the code. All you can do is just change the range as per your requirements.

• And, finally, following the steps will transform the data to a log.

VBA Code Explanation

``Sub TransformDataToLog()``

Sub is a part of code that is used to handle the work in the code but will not return any value. It is also known as subprocedure. So we name our procedure TransformDataToLog().

``Dim inte As Integer``

The DIM statement in VBA refers to ‘declare,’ and it must be used to declare a variable. So, we declare the integer value as inte.

``````For inte = 5 To 10
Cells(inte, 4) = Log(Cells(inte, 3))
Next inte``````

The For Next Loop begins with row 5, we chose 5 as the beginning value. The Cells property is then used to write values. Finally, the VBA Log function to complete our primary work, and we have used the cells property to run over our cell values again.

``End Sub``

This will end the procedure.

## Things to Remember

• If we don’t give numerical values inside our LOG routines, we will get the ‘#Value!’ error.
• The ‘#Num!’ error will appear if the base is 0 or a negative value.
• The ‘#DIV/0!’ error will show once again if our base is 1.

## Conclusion

The above methods will assist you in Transform Data to Log in Excel. Hope this will help you! Please let us know in the comment section if you have any questions, suggestions, or feedback. Or you can have a glance at our other articles in the ExcelDemy.com blog!

## Related Articles

#### Sabrina Ayon

Hi there! This is Sabrina Ayon. I'm really excited to welcome you to my profile. Currently, I'm working in SOFTEKO as a Team Leader. I'm a graduate in BSc in Computer Science and Engineering from United International University. I love working with computers and solving problems. I’ve always been interested in research and development. Here I post articles related to Microsoft Excel. Hoped this may help you. Thank you.

We will be happy to hear your thoughts

5 Excel Hacks You Never Knew