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

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on November 9, 2023

This tutorial demonstrates how to use the LOG10 Function in Excel to calculate the base-10 logarithm of 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)``

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

## 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: