The Excel GCD function is a Math formula that returns the greatest common divisor (GCD) of two or more numbers. The greatest common divisor of a set of values is the largest positive number that divides each number. In this guide, we’re going to show you how to use the GCD function and also go over some tips and error handling methods.
Supported versions
- All Excel versions
Excel GCD Function Syntax
Arguments
number1 |
The first number or array of numbers you want to calculate the greatest common divisor (GCD) for. |
[number2], … |
Optional. Additional numbers up to 254 number (total 255). |
Example
The GCD function can essentially take any number of values as arguments and the result will be the GCD of all inputs. You can use static values or references as arguments. Below are some examples for different use cases involving static and dynamic references.
=GCD({15;5})
=GCD(B3,C3)
=GCD(B3:C3)
Tips
- The GCD function can use static numbers, arrays, or references as arguments to find the greatest common divisor.
- One divides any value evenly.
- A prime number has only itself and one as even divisors.
- If any argument value is not an integer, it is going to be truncated.
- Use the LCM function to calculate the least common multiple of numbers.
Issues
- If any argument is a negative number, the function returns a #NUM! error.