GCD function. The greatest common divisor.(Microsoft Excel)

03/27/2024

Function to get the greatest common divisor given multiple numbers.

How it works

=GCD(number1 to 255)
NameOmissionExplanation
number1 to 255Required argument. 
Multiple numbers to get the greatest common divisor. In many cases, a cell range is specified.

Demonstrate

In this example, 3 numbers are specified, but up to 255 can be specified.
Negative numbers will result in a #NUM!.

Spill

Because the function assumes a cell range, it is not a Spill as is.

To Spill, use BYROW or BYCOL functions.

=BYROW(B3:D9,LAMBDA(r,GCD(r)))
Row direction
=BYCOL(H2:N4,LAMBDA(c,GCD(c)))
Column direction

---

Links

Microsoft Excel Functions Math & Trig

LCM Function.Least common multiple.