What is the GCD function?
=GCD(number1, [number2], ...)GCD returns the greatest common divisor: the largest integer that divides all the numbers evenly.
According to Microsoft, decimals are truncated, and any value below 0 returns #NUM!.
GCD reduces fractions, finds a screen's aspect ratio (1920 × 1080 is 16:9) and gives the largest square tile that covers a floor with no cutting: anywhere you need the biggest number that divides everything evenly.
Arguments
- number1, number2, ...
- From 1 to 255 integers.
GCD examples
Example 1. 5 and 2
=GCD(5, 2)An example from Microsoft: 1.
Example 2. 24 and 36
=GCD(24, 36)12.
Example 3. Three numbers
=GCD(24, 36, 60)12. You can give up to 255 arguments.
Example 4. Ratios and reduced fractions
=A2/GCD(A2,B2)&":"&B2/GCD(A2,B2)Dividing both numbers by their greatest common divisor gives the simplest ratio.
A2 B2 GCD Result 1920 1080 120 16:9 12 18 6 2:3 360 240 120 3:2 Example 5. Largest square tile
=GCD(360, 240)A 360 cm × 240 cm floor is covered exactly by 120 cm tiles, 3 by 2.
Common mistakes
Negative numbers
They return #NUM!.
Decimals
2.9 is used as 2. It is truncated, not rounded.
Including 0
=GCD(12, 0) is 12. Every number divides 0, so it does not change the result.
FAQ
- How do I simplify a fraction?
- Divide the numerator and denominator by their GCD.
- Can I use a range?
- Yes, for example =GCD(A2:A10).
- And the least common multiple?
- Use LCM. For two numbers, GCD × LCM equals their product.