GCD Function

Excel 2007+

Summary

The Excel GCD function calculates the greatest common divisor (GCD) of two or more integers. The GCD represents the largest positive integer that fully divides each of the given numbers without leaving a remainder, making it essential for simplifying fractions and mathematical analysis.

Syntax

GCD(number1, [number2], ...)

Parameters

Parameter Type Required Description
number1 Number Yes First positive integer (required) - truncated if not an integer
number2 Number No Additional positive integers (optional) - up to 255 total arguments

Using the GCD Function

GCD is primarily used in mathematics for simplifying fractions, solving Diophantine equations, and understanding number relationships. In Excel, it's valuable for data analysis involving ratios, financial modeling requiring fraction reduction, and mathematical computations where common factors need identification.

Common GCD Examples

Basic GCD Calculation

=GCD(5,2)

Returns 1, the largest number dividing both 5 and 2 evenly.

Multiple Numbers

=GCD(24,36)

Returns 12, the greatest common divisor of 24 and 36.

With Zero

=GCD(5,0)

Returns 5, as GCD with zero equals the other number.

Three Numbers

=GCD(48,36,24)

Returns 12, common divisor for all three values.

Frequently Asked Questions

GCD returns #NUM! error. All arguments must be zero or positive integers.

Yes, but decimals are truncated to integers before calculation.

Up to 255 arguments can be provided.

Common Errors and Solutions

#VALUE!

Cause: Non-numeric argument provided

Solution: Ensure all arguments are numbers

#NUM!

Cause: Negative number or value >= 2^53

Solution: Use only positive integers under 2^53

#NUM!

Cause: Argument less than zero

Solution: Use absolute values or positive numbers only

Notes

  • GCD(5,0) returns 5
  • Prime numbers return 1 with any number except multiples
  • 1 divides every integer evenly
  • Useful for simplifying ratios in data analysis

Compatibility

Available in: Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Microsoft 365

Not available in: Excel 2003 and earlier

Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 2007+