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

ArgumentRequired?What it does
number1YesA whole number (decimals are truncated).
number2, …OptionalMore numbers.

Examples

Example 1 — Biggest equal pack

Split 24 widgets and 36 gadgets into identical gift packs, no leftovers.

C2fx=GCD(A2, B2)
ABC
1WidgetsGadgetsPacks
2243612
318279
41071
=GCD(A2, B2) Explain

Example 2 — Simplifying a ratio

Show 24:36 as 2:3.

=A2/GCD(A2,B2)&":"&B2/GCD(A2,B2) Explain

Common mistakes

  • Negative numbers. Return #NUM!.

Notes

Kyle Stott

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.