# LOG10 Function Examples in Excel, VBA, & Google Sheets

This Tutorial demonstrates how to use the Excel LOG10 Function in Excel to calculate the base-10 logarithm of a number.

## LOG10 Function Overview

The LOG10 Function Calculates the base-10 logarithm of a number.

To use the LOG10 Excel Worksheet Function, select a cell and type:

(Notice how the formula inputs appear)

## LOG10 Function Syntax and Inputs:

``=LOG10(number)``

number – A number.

## LOG10 Function

The LOG10 Function returns the logarithm of a number to base 10.

``=LOG10(100)``

## LOG10 Function – Decimal

The LOG10 Function can also return the logarithm of a decimal number to base 10.

``=LOG10(0.1)``

## LOG10 Function – Negative Number/Zero

The LOG10 Function will return an error if the argument is zero or a negative number.

``=LOG10(0)``

``=LOG10(-3)``

## LOG10 Function – Power of 10

The LOG10 Function will return the exponent if the argument is expressed as a power of 10.

``=LOG10(10^6)``

### Easy Excel Automation

The LOG10 Function works exactly the same in Google Sheets as in Excel:

Use the LOG10 Function to calculate the logarithm of a number to base-10. Simply enter any number directly into the formula, or reference a cell containing a number.

## LOG10 Examples in VBA

You can also use the LOG10 function in VBA. Type:

``application.worksheetfunction.log10(number)``

Executing the following VBA statements

``````Range("B2") = Application.WorksheetFunction.Log10(Range("A2"))
Range("B3") = Application.WorksheetFunction.Log10(Range("A3"))
Range("B4") = Application.WorksheetFunction.Log10(Range("A4"))
Range("B5") = Application.WorksheetFunction.Log10(Range("A5"))
Range("B6") = Application.WorksheetFunction.Log10(Range("A6"))
Range("B7") = Application.WorksheetFunction.Log10(Range("A7"))
Range("B8") = Application.WorksheetFunction.Log10(Range("A8"))
Range("B9") = Application.WorksheetFunction.Log10(Range("A9"))``````

will produce the following results

For the function arguments (number, etc.), you can either enter them directly into the function, or define variables to use instead.