GCD Function in ONLYOFFICE Spreadsheet Editor: Common Divisors and Examples
Learn the GCD formula in ONLYOFFICE with repeatable integer pairs, tile sizing, fraction simplification and verified documentation.
Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in ONLYOFFICE Spreadsheet Editor. How formula examples are checked
Quick answer: =GCD(84,126) has the mathematical expected result 42. The vendor documents GCD(number1, [number2], ...) and up to 255 numeric values. The result is the greatest common divisor of the supplied numbers, not a fraction, not their product, and not the least common multiple.
Verification: All outputs are independently calculated mathematical expectations. Native Desktop/web execution, localized parsing and runtime error observation were not performed.
What the function does and when it helps
GCD finds the greatest positive integer that divides each selected positive integer evenly. It is useful for simplifying ratios, cutting identical-size tiles from a rectangular sheet, and finding a shared grouping size.
For positive whole numbers, a common divisor divides both operands without a remainder. The GCD is the largest such divisor. For example, 84=42×2 and 126=42×3, so their greatest common divisor is 42. For three positive values, the mathematical property gcd(a,b,c)=gcd(gcd(a,b),c) applies.
Exact official syntax, argument order and defaults
=GCD(number1, [number2], ...)
| Argument | Required? | Type and purpose |
|---|---|---|
number1 |
Required | First numeric value. Use positive whole numbers in these tested mathematical examples. |
number2, additional values |
Optional in the published syntax | Additional numeric values (up to 255 numeric values total according to the vendor); the reference prose says “two or more numbers.” |
No numeric default is documented for any supplied value. The official signature marks number2 optional, but the descriptive text says two or more numbers; this guide illustrates two or more values and leaves one-value edge semantics to native testing. These argument rules are grounded in the ONLYOFFICE GCD function reference (accessed 2026-10-13 UTC). The square brackets in the official signature indicate an optional argument; do not type them as literal characters. For GCD and LCM, the ... notation indicates successive values, not a literal formula token.
Reproduce the calculations in ONLYOFFICE
- Open a scratch workbook in ONLYOFFICE Spreadsheet Editor, or create a blank sheet. These are test instructions, not a claim of native editor execution.
- Select the specified cells and type the values exactly as displayed in the table below. Put the listed formula in the indicated result cell (or type the first formula and use the fill handle to copy it down).
- In the English interface, type a leading
=and use commas to separate arguments. The official Insert Functions guide documents both this entry workflow and comma separation in its English examples. - Inspect the result and compare it to the independently calculated expected number. Any different output is evidence to investigate, not proof the documentation is incorrect; check value types and formula-language settings first.
- Change one input and verify that the result recalculates. The official guide documents automatic workbook recalculation by default and a Formula → Calculation control when needed.
Validation classification: The function signature and documented argument description were checked against the vendor reference. All numbers below were calculated separately using Python’s standard math module, then sanity-checked using mathematical identities. Native execution: not performed; no cell output or exact error code was observed.
Locale, function language and numeric entry
These examples use English ONLYOFFICE function names, commas, and a decimal point only where relevant. The Advanced Settings documentation describes independently configurable formula-language and region settings; it does not establish which exact translated names or separators are supported by every installation or version. Do not silently replace commas, assume identical localized names, or interpret a number containing locale separators until testing the target editor. The documented maximum of 255 numeric arguments for GCD/LCM is a function-reference claim, not a native stress-test result.
Desktop, browser, historical releases and other spreadsheet editors
The official Spreadsheet Editor function catalogue documents the English function names in the current, unversioned ONLYOFFICE Help Center. It is not a release-by-release runtime compatibility table. ONLYOFFICE Desktop Editors and browser-hosted Docs have separate release histories; neither the function page nor the current catalogue identifies the first Desktop, cloud or self-hosted release for this function. The exact tested build matrix remains unverified. In particular, an identically named function in Excel or Google Sheets is not evidence for ONLYOFFICE’s coercion rules, errors, array treatment or display precision. No cross-product formula-execution test was performed.
Reproducible worksheet: GCD with actual cell references
Type each pair into A2:B13. In C2, enter the displayed formula and fill down through C13. The reference uses one cell per numeric argument, which avoids making undocumented claims about how whole arrays or blank cells are handled.
| Row | A: first positive integer | B: second positive integer | Formula in C | Independently expected C |
|---|---|---|---|---|
| 2 | 84 |
126 |
=GCD(A2,B2) |
42 |
| 3 | 48 |
180 |
=GCD(A3,B3) |
12 |
| 4 | 35 |
64 |
=GCD(A4,B4) |
1 |
| 5 | 24 |
36 |
=GCD(A5,B5) |
12 |
| 6 | 72 |
120 |
=GCD(A6,B6) |
24 |
| 7 | 100 |
250 |
=GCD(A7,B7) |
50 |
| 8 | 18 |
27 |
=GCD(A8,B8) |
9 |
| 9 | 99 |
121 |
=GCD(A9,B9) |
11 |
| 10 | 30 |
42 |
=GCD(A10,B10) |
6 |
| 11 | 81 |
153 |
=GCD(A11,B11) |
9 |
| 12 | 64 |
96 |
=GCD(A12,B12) |
32 |
| 13 | 14 |
49 |
=GCD(A13,B13) |
7 |
How results were computed: Python math.gcd using integer inputs, then checked against divisibility / multiplicative or factorial identities. Formulas are intended as reproducible worksheet instructions, not observed workbook outputs. The exact display (e.g., number separators, decimals, scientific notation) can vary by editor and regional settings.
Additional paste-ready formula examples
Paste each into a blank scratch cell. Expected numbers are independent mathematical calculations; the exact success/error outcome of the native implementation remains to be tested.
| Paste-ready formula | Expected numerical value |
|---|---|
=GCD(12,18,30) |
6 |
=GCD(8,12,16,20) |
4 |
=GCD(84,126) |
42 |
=GCD(35,64) |
1 |
=GCD(72,120) |
24 |
=GCD(48,180) |
12 |
=84/GCD(84,126) |
2 |
=126/GCD(84,126) |
3 |
=(84/GCD(84,126))*(126/GCD(84,126)) |
6 |
Advanced uses and worked reasoning
Cut a rectangular board into the largest equal square tiles
Suppose A2 contains a length of 84 cm and B2 a width of 126 cm. Formula =GCD(A2,B2) has expected result 42, so squares measuring 42 cm × 42 cm exactly tile the board with no offcuts. The expected number of squares is (84/42)×(126/42)=6. To calculate both quantities in a worksheet, put =GCD(A2,B2) in C2 and =(A2/C2)*(B2/C2) in D2. Expected D2: 6. This works for positive integer dimensions expressed in the same unit; it is not a universal solution for real-world cutting loss or blade kerf.
Reduce a fraction and retain exact integers
With 84 in A2 and 126 in B2, =A2/GCD(A2,B2) has expected result 2 and =B2/GCD(A2,B2) has expected result 3. Read the reduced fraction as 2/3. If either operand changes, both parts recompute. Avoid treating a displayed fraction like 2/3 as proof that the underlying cell is stored as an exact rational; these formulas produce whole-number numerator and denominator individually.
Equal-sized mixed-item packages
Suppose a charity has 48 scarves and 180 gloves and wants as many identically composed packages as possible with no leftovers. =GCD(48,180) has expected answer 12 packages, with 48/12=4 scarves and 180/12=15 gloves per package. A different objective (such as maximizing pieces per package rather than number of packages) requires a different model.
Three or more inputs
=GCD(12,18,30) has expected result 6 (independent math.gcd). =GCD(8,12,16,20) has expected result 4. These formulas exercise the documented ability to supply multiple numeric arguments. Handling a single contiguous range such as =GCD(A2:A4) should be checked natively before relying on range, blank or text coercion.
Errors, edge cases, limits and troubleshooting
| Symptom or scenario | What to check | Evidence classification |
|---|---|---|
GCD(35,64) looks unexpectedly small |
The numbers are coprime; the greatest shared positive divisor is 1. | Mathematical expectation. |
| Expecting 252 instead of 42 for 84 and 126 | 252 is their least common multiple; GCD is 42. | Independent calculation; distinguish from LCM. |
| Entering zero or negative values | The official article does not state exact zero/negative conversion rules or errors. These examples intentionally use positive integers. | Native test required. |
| Entering 4.5 or a text cell | The function article does not document truncation or conversion. Do not borrow Excel’s behaviour as ONLYOFFICE fact. | Native test required. |
| Trying 256 input arguments | ONLYOFFICE documents up to 255 numeric values. Exact overflow diagnostic is not shown in the vendor text. | Vendor limit; native diagnostic pending. |
| Formula accepted but result looks wrong | Check input cells are numerical, values share units when measuring, and the intended operation was GCD rather than LCM. | Worksheet audit procedure. |
Important: The vendor function article does not specify literal error codes for invalid values, decimal truncation, text coercion, mixed arrays or particular calculation overflow behaviour. A different spreadsheet application’s documentation does not establish ONLYOFFICE’s result. Before relying on undocumented behavior, record results natively in representative Desktop and browser versions with each regional setting in scope.
Related links and claim-level official sources
| Claim or link | Vendor source (checked 2026-10-13 UTC) | Evidence quality |
|---|---|---|
Return the greatest common divisor of two or more numbers; syntax GCD(number1, [number2], ...), up to 255 numeric values. |
GCD function reference | Official function-specific description; unversioned. |
| Current catalogue lists GCD under Math and Trigonometry and permits formula insertion through Home/Formula controls. | ONLYOFFICE Insert Functions catalogue | Official current online documentation; not full Desktop/web version proof. |
Current English documented formulas use a leading = and commas for multiple arguments. |
ONLYOFFICE Insert Functions instructions | Official entry-method documentation. |
| Formula language and region are configurable. | ONLYOFFICE Advanced Settings | Official interface documentation; locale-specific examples require native testing. |
| Desktop release chronology is separately documented. | ONLYOFFICE Desktop Editors changelog | Official release history; minimum function version not established. |
| Cross-check related mathematical operation where applicable. | Related ONLYOFFICE function | Official documentation; numerical values in this guide remain independently computed. |
Verification limitations
Native input coercion, invalid-input errors, historical release support, localized formula entry and workbook round trips remain untested.