Arte SheetsLearn. Try. Understand.

Math

GCD function: simplify aspect ratios and find largest equal batch sizes

Find the greatest common divisor of two or more integers with GCD to reduce screen or recipe ratios to lowest whole terms.

Reduce pixel dimensions or mix ratios automatically

GCD(number1, [number2], ...) returns the largest integer that divides every input without a remainder. Dividing both sides of a 1920 x 1080 display by GCD(1920, 1080) = 120 reduces the resolution cleanly to "16:9".

In warehouse kitting, GCD(240, 180, 300) = 60 tells you the maximum number of identical combo kits you can assemble with zero leftover parts.

Width (A)Height (B)GCD(A, B)Simplified Ratio
1920108012016:9
256016003208:5

Build a live simplified ratio string

Divide Width and Height by GCD(A2, B2) and join them with ":" to display the reduced integer ratio.

Use nonnegative integer dimensions and reject the all-zero pair before dividing by GCD; GCD(0,0)=0 cannot be used as a divisor. Decimal measurements require an agreed integer unit first.

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

Zero and negative input rules

GCD(0, n) returns n, and GCD(0, 0) returns 0. Because divisors of ratios are defined on non-negative integers in spreadsheets, guard negative inputs with IF(MIN(A2, B2)<0, ...).

=IF(MIN(A2, B2)<0, "Non-negative only", GCD(A2, B2))

Try the example

Use the original values or change them to test your understanding.

Further reading