Contact

GCD Function (OpenOffice Calc)

Math Intermediate OpenOffice Calc

Learn the GCD function in Apache OpenOffice Calc: Greatest Common Divisor.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Availability and version history

  • Introduced: Documented by Apache OpenOffice 4.1.16; original introduction not established.
  • Availability: Supported in Apache OpenOffice 4.1.16, verified against its function registry. This identifies a supported release, not a final working version.
  • Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
  • Checked: 2026-10-14 — function reference; versioned support. Documentation/source check; not a new native test. Existing example-specific test claims below retain their stated scope.

GCD returns the greatest common divisor of nonnegative integers: the largest positive integer that divides each nonzero input without a remainder. It is useful for simplifying ratios or dividing several quantities into equal groups with no leftovers. It is a divisor, not a common multiple.

Syntax and arguments

=GCD(number1; number2; ...)
=GCD(A2:A4)

Supply at least one argument; the versioned help documents up to 30 arguments, including ranges. Use nonnegative whole numbers. The core 4.1.16 interpreter floors numeric inputs approximately and rejects negative effective values. This guide concerns core GCD, not the separately named Analysis add-in function GCD_ADD. Formulas here use English function names and semicolon argument separators.

Reproducible examples

Formula Expected result
=GCD(12;18) 6
=GCD(16;32;24) 8
=GCD(7;11) 1
=GCD(0;18) 18
=GCD(0;0) 0
=GCD(12.9;18.9) 6

The first formula preserves the original worked example. Its older comparable LibreOffice 25.2 check was not execution in OpenOffice. These new results are independently calculated expectations; no fresh native or GUI test is claimed.

Practical worksheet: make identical mixed-item packs

Enter 12 in A2 and 18 in B2 for two item stocks. In C2 enter =GCD(A2;B2) to get 6 identical packs using all items. In D2 enter =A2/C2 and in E2 enter =B2/C2; each pack contains 2 of the first item and 3 of the second.

Try a second row with A3=20 and B3=30. Fill C2:E2 down to row 3. There are 10 packs containing 2 and 3 items respectively. This solves the maximum number of equal-composition packs, not the maximum items in one pack or a requirement for a minimum pack size. Validate quantities and practical packing constraints separately.

Advanced applications

Reduce a ratio. With 84 in A2 and 126 in B2, =GCD(A2;B2) gives 42. Dividing both sides by 42 gives the equivalent ratio 2:3. Keep numerator and denominator in separate numeric cells if later arithmetic is required. A text label made with &":"& is only a display.

Use a range. Put 9, 12 and 9 in A2:A4. =GCD(A2:A4) returns 3. A range is one function argument containing multiple cells; it need not be expanded into a long list of separate references.

Cross-check with LCM. For positive integer inputs 12 and 18, GCD=6 and LCM=36; 636 equals 1218=216. This identity checks a small two-value example. Do not apply the ratio rearrangement blindly when both inputs are zero.

Errors, edge cases and troubleshooting

GCD(0;a)=a for nonnegative a; the pinned core implementation returns 0 for GCD(0;0). In the packing worksheet, dividing by that result would fail, so handle an all-zero inventory before computing per-pack quantities. A greatest common divisor of 1 means no larger integer divides all inputs; it does not mean the inputs are equal.

Fractions are floored before the integer operation. GCD(12.9;18.9)=6 therefore does not measure a common real-valued unit of the original decimals. If quantities represent fixed-scale currency or lengths, choose an explicit integer unit and validate the conversion rather than assuming decimal arithmetic is exact.

Do not generalize input handling across scalar arguments, ranges and array constants. The core source uses separate paths: a matrix containing nonnumeric elements is rejected, while ranges use a value iterator. Upstream errors are not a promise of ignored data. Validate a clean numeric range rather than depending on accidental text coercion. Large integers also encounter the ordinary floating-point precision limit.

Documentation and verification

See the Apache OpenOffice GCD reference, versioned mathematical-function help, and 4.1.16 implementation. The saved official source snapshots were re-read for this guide; their original retrieval records remain in the evidence package. Source inspection and independent arithmetic are not application execution. The lifecycle section identifies a supported release; the original introduction and final functioning release remain unestablished.