GCD Function
Returns the greatest common divisor of whole numbers.
Category
Math & Trig
Available in
All versions, Microsoft 365
Returns
A whole number
Want to practice GCD in a real spreadsheet? Open a blank sheet in our Practice Sandbox and try it with live data, with the AI Excel tutor beside you. No Excel needed — just a free account.Try it free in the Sandbox
Overview
GCD finds the largest number that divides all your numbers exactly: GCD(24, 36) is 12.
Useful for simplifying ratios and finding the biggest equal pack size.
Syntax
=GCD(number1, [number2], …)
Arguments
| Argument | Required? | What it does |
|---|---|---|
| number1 | Yes | A whole number (decimals are truncated). |
| number2, … | Optional | More numbers. |
Examples
Example 1 — Biggest equal pack
Split 24 widgets and 36 gadgets into identical gift packs, no leftovers.
C2fx=GCD(A2, B2)
| A | B | C | |
|---|---|---|---|
| 1 | Widgets | Gadgets | Packs |
| 2 | 24 | 36 | 12 |
| 3 | 18 | 27 | 9 |
| 4 | 10 | 7 | 1 |
=GCD(A2, B2) Explain
Common mistakes
- Negative numbers. Return #NUM!.
Notes

Author
Kyle Stott
Certified Microsoft Excel Expert
Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.