top of page

How to use the GCD Function


How to use the GCD Function in Excel

The GCD function finds and returns the greatest common divisor (GCD) of two or more numbers.

Contents:



Syntax

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

number1 - the first number for which you want to find the greatest common divisor

number2, ... - [optional] additional numbers to be calculated in the greatest common divisor


Explanation

The GCD function is part of the "Math and Trigonometry" group of functions within Excel.


The GCD function in Excel works by iterating through each of the given numbers and determining the largest integer that can divide all of the numbers evenly.


For example, if you have the range of values: 2, 8, and 12, 2 is the greatest common divisor that can evenly divide into 2, 8, and 12.


For any number that includes decimals, the number is truncated and the GCD is returned from the whole number. For instance, 3.5 would be read as 3 by this function.


Note:

If any input is non-numeric, a #VALUE! error will be returned.

If any argument is negative, a #NUM! error will be returned.


Examples

How to Simplify Fractions in Excel (Reduce a Fraction to Lowest Terms)

In this example, we'll demonstrate how to simplify a fraction, or reduce a fraction to its lowest terms.


Let's say you have the fraction 12/16, and you want to simplify it. You can use the GCD function to find the greatest common divisor of the numerator and the denominator, then divide both by the GCD, leaving you with a simplified numerator and denominator.


Here's a table illustrating this example:

How to Simplify Fractions in Excel (Reduce a Fraction to Lowest Terms) using a formula

In Excel, you would enter the following formula to find the GCD of 12 and 16:

=GCD(numerator, denominator)
=GCD(A2, A3)

The result would be 4. Then, you would divide both the numerator and the denominator by 4 to get the simplified fraction 3/4.



How to Simplify Gear Ratios in Excel

Using the same method, we can also simplify gear rations given the number of teeth between two gears.


Suppose you have two gears in a machine, one with 18 teeth and the other with 24 teeth. You can use the GCD function to determine the greatest common divisor of the number of teeth on each gear, and then divide both numbers by the GCD to find the simplified gear ratio.


The result would be 6. Then, you would divide the number of teeth on each gear by 6 to get the simplified gear ratio, which is 3:4.

How to Simplify Gear Ratios in Excel using a formula

This can be combined into one formula:

= (gear1/GCD(gear1:gear2)) & ":" & (gear2/GCD(gear1:gear2))
= (A2/GCD(A2:B2)) & ":" & (B2/GCD(A2:B2))






bottom of page