LOG Function Examples – Excel, VBA, & Google Sheets

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on November 9, 2023
Download Example Workbook

Download the example workbook

This tutorial demonstrates how to use the LOG Function in Excel to calculate the logarithm of a number to a specified base.

LOG Main Function

LOG Function 

The LOG Function returns the logarithm of a number to the specified base.

=LOG(64,4)

LOG-01

LOG Function – Base 10

The LOG Function will return the logarithm of a number to base 10 if the second argument is omitted.

=LOG(1000)

LOG 02

Alternatively, the LOG10 Function can also be used. To learn more, click here.

LOG Function – Base ‘e’

The LOG Function can return the logarithm of a number to base ‘e’.

=LOG(5, EXP(1))

LOG 03

Alternatively, the LN Function can also be used. To learn more, click here.

LOG & POWER Function

The LOG Function is a reverse of the POWER Function. The LOG Function returns the power to which the given base was raised.

Let’s say we raise 7 to the power of 3.

=POWER(7,3)

LOG 04 01

The resulting number when entered in the LOG Function to the base 7 will return the power.

=LOG(343,7)

LOG 04 02

LOG Function – Negative Number/Zero

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

=LOG(0)

LOG 05 01

=LOG(-5)

LOG 05 02

LOG in Google Sheets

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

LOG Gsheet

LOG Examples in VBA

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

application.worksheetfunction.log(number,base)

AI Formula Generator

Try for Free

Excel Practice Worksheet

practice excel worksheet

Practice Excel functions and formulas with our 100% free practice worksheets!

  • Automatically Graded Exercises
  • Learn Excel, Inside Excel!

Free Download

Return to List of Excel Functions