1. Home
  2. Functions
  3. Math
  4. GCD

GCD function

Returns the greatest common divisor of whole numbers.

Syntax

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

Arguments

ArgumentRequiredDescription
number1RequiredThe first number or range
number2OptionalMore numbers or ranges

How to use GCD

GCD takes 1 required argument and 1 optional argument, and accepts more values in the same pattern. Type =GCD( in a cell and SheetsBat shows the arguments as you go. Optional arguments are shown in square brackets; leave them out to use their default.

Examples

Each result below was calculated by the SheetsBat formula engine.

=GCD(24, 36)Result 12
=GCD(5, 2)Result 1
=GCD(5, 0)Result 5

Every formula, right in your browser

SheetsBat calculates 536 functions, with charts, pivot tables and live collaboration. Free to start.