Formualizer Docs
ReferenceFunctionsMath Functions

GCD

GCD: Returns the greatest common divisor of one or more integers.

Summary

GCD truncates each argument toward zero before calculating the divisor.

Remarks

  • Inputs must be between 0 and 9.99999999e9 after truncation, or #NUM! is returned.
  • Negative values return #NUM!.
  • Any argument error propagates immediately.

Examples

Greatest common divisor of two numbers
Grid
CellValue
No inputs on Sheet1.
Formula
=
Result
Not evaluated yet.
Expected
12
Variadic and fractional arguments
Grid
CellValue
No inputs on Sheet1.
Formula
=
Result
Not evaluated yet.
Expected
6
Negative values are invalid
Grid
CellValue
No inputs on Sheet1.
Formula
=
Result
Not evaluated yet.
Expected
#NUM!

FAQ

What happens to decimal inputs in GCD?

Each argument is truncated toward zero before the divisor is computed.

When does GCD return #NUM!?

Negative values or values outside the supported bound return #NUM!.

Runtime metadata

Category

Math

Signature

GCD(arg1: Number, arg2…: Number)

Arity

min 1, max variadic

Arguments

arg1

Number · Scalar · coercion NumberLenientText

arg2

Number · Scalar · coercion NumberLenientText

Caps

PURE

Source

On this page