Gcd
GCD Function¶
The GCD function in Excel calculates the greatest common divisor (GCD) of two or more integers. The GCD is the largest integer that can evenly divide all the given numbers without leaving a remainder.
Syntax:¶
GCD(number1, [number2], ...)
- number1: The first number for which you want to calculate the greatest common divisor.
- number2, ... (optional): Additional numbers for the calculation. You can include up to 255 numbers.
Key Characteristics:¶
- The function works only with integers. If any number is not an integer, Excel automatically truncates it to an integer.
- If any input is zero, the GCD of the remaining numbers is returned.
- If all inputs are zero, the function returns
0. - The
GCDfunction is useful in mathematical and computational tasks, such as simplifying fractions or finding common factors.
Examples:¶
-
=GCD(8, 12)
Returns4, as4is the largest number that divides both8and12. -
=GCD(28, 35, 42)
Returns7, as7is the largest number that divides28,35, and42. -
=GCD(18, 0)
Returns18, since any number's GCD with0is the number itself. -
=GCD(0, 0)
Returns0, as the GCD of two zeros is undefined and defaults to0. -
=GCD(3.9, 2.4)
Returns1, as Excel truncates the numbers to3and2, and the largest divisor of3and2is1.
Usage Notes:¶
- If any of the arguments are negative, the function treats them as positive for the calculation.
- Non-numeric inputs will result in an error.
- The
GCDfunction is particularly valuable in tasks like reducing ratios, simplifying fractions, or determining shared divisors in data analysis.