Skip to main content

Excel GCD Function

The GCD function returns the greatest common divisor of two or more integers. The greatest common divisor is the largest integer that divides numbers without a remainder.

gcd function 1


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


  • Number1 (required): The first number.
  • Number2, ... (optional): The subsequent numbers.

Return value

The GCD function returns a positive numeric value.

Function notes

  1. Arguments in the GCD function should be supplied as numeric values. Up to 255 arguments are allowed.
  2. Integers are preferred in the arguments. If any of the supplied arguments are non-integer numbers, the GCD function will truncate them to integers.
  3. GCD function will return the #VALUE! error if any of the supplied arguments are non-numeric.
  4. GCD function will return the #NUM! error if:
    • any argument < 0
    • returned result ≥ 2^53
  5. Empty cells in the arguments are treated as zeros.


Supposing, you want to get the greatest common divisor of the values in the table below. Please do as follows.

1. Copy the formula below into cell G4.

=GCD (B4:E4)

2. Then drag the fill handle down to the cells you want to apply this formula too. The results are as the following screenshot shows.

gcd function 2


  1. The argument in the above formula is supplied as a range that contain multiple values.
  2. We can directly input values in the arguments of the formula. For example, in cell G4, the formula can be changed to:

    =GCD (5, 25) or =GCD (5, 25, 0, 0)

  3. We can also use cell references as arguments of the formula. For example, in cell G4, the formula can be changed to:

    =GCD (B4, C4) or =GCD (B4, C4, E4, F4)

  4. If there is no common divisor between the given numbers, it returns the number 1.

Relative Functions:

  • Excel EVEN Function
    The EVEN function rounds numbers away from zero to the nearest even integer.

  • Excel EXP Function
    The EXP function returns the result of the constant e raised to the nth power.

The Best Office Productivity Tools

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations