Return to List of Excel Functions

GCD Function Examples – Excel, VBA, & Google Sheets

This Excel Tutorial demonstrates how to use the Excel GCD Function in Excel to calculate the greatest common divisor, with formula examples.

GCD Function Description:

The GCD Function Calculates the greatest common divisor between two or more numbers. The greatest common divisor is the largest integer that will divide into all of the numbers.

Formula Examples:

gcd function examples

Example Formula Result
1 =GCD(C5,D5) 1
2 =GCD(C6,D6) 10
3 =GCD(C7,D7) 5
4 =GCD(C8,D8) #NUM!

Syntax and Arguments:

The Syntax for the GCD Formula is:

=GCD(number1,number2)

Function Arguments ( Inputs ):

number1 – Two or more numbers, separated by commas, or an array of numbers.

Additional Notes

Use the GCD Function to calculate the greatest common divisor for a number. Simply enter any number directly into the formula, or reference a cell containing a number.

GCD Examples in VBA

vba code generator
You can also use the GCD function in VBA. Type:

Application.Worksheetfunction.Gcd(number1,number2)

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

Return to the List of all Functions in Excel

Easy Excel Automation

Add Excel automation to your workbook with just a few clicks.

Learn More

How to use the GCD Function in Excel:

To use the AND Excel Worksheet Function, type the following into a cell:

=AND(

After entering it in the cell, notice how the AND formula inputs appear below the cell:
gcd formula syntax
You will need to enter these inputs into the function. The function inputs are covered in more detail in the next section. However, if you ever need more help with the function, after typing “=GCD(” into a cell, without leaving the cell, use the shortcut CTRL + A (A for Arguments) to open the “Insert Function Dialog Box” for detailed instructions:
how to use the gcd function in excel

For more information about the GCD Formula visit the
Microsoft Website.

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